In Designer mode

Let us create the conditional formatting.

  1. In Designer, open the MaterialsAndServices list form and create the OnCreateAtServer form event handler.
  2. Add the script shown in listing 27.3 to the handler.

    Listing 27.3. OnCreateAtServer form event handler

    &AtServer
    Procedure OnCreateAtServer(Cancel, StandardProcessing)
        CatalogList = Items.List;
     
        // Setting appearance for the catalog
        CatalogList.Representation = TableRepresentation.List;
     
        // Hiding grid lines
        CatalogList.VerticalLines = False;
        CatalogList.HorizontalLines = False;
     
    EndProcedure
    This procedure is executed on the server when the form is created. First, it changes the list view from hierarchical to flat, so that you can see materials and services at the same time.

    Then it hides the grid lines that separate columns and rows of the list table.

    Now let us proceed to specifying conditional appearance for the list rows.
  3. Open the property palette of the List form attribute (it is the main form attribute).
  4. In the List setup field, click Open (fig. 27.10).


    Fig. 27.10. Opening dynamic list setup

    Since the attribute has DynamicList type, which is based on a data composition system, you can apply filter, sorting, grouping, and conditional appearance to it in the same manner as you did in reports.
  5. In the dynamic list settings window that is opened, click the Conditional appearance tab and then click Add .

    First, let us specify the formatting for highlighting fields.
  6. In the Format field, click the selection button  and select lavender color for the background (fig. 27.11).


    Fig. 27.11. Conditional appearance settings
  7. Click OK.
    Then let us specify the condition for the appearance to be applied (when list rows should have lavender color).
  8. In the Condition field, click the selection button .
  9. In the window that is opened, click the Add  button and then click New item.
  10. In the Left value column, select MaterialServiceType.
  11. In the Comparison type column, select Equal to.
  12. In the Right value column, select Enum.MaterialServiceTypes.Service (fig. 27.12).


    Fig. 27.12. Conditional appearance settings
  13. Click OK.

    So you have defined that services have lavender background in the list.

    Since there is no need to highlight individual cells, you can leave the list of formatted fields empty.
  14. Click OK.
Next page: In 1C:Enterprise mode
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.