In Designer mode

The generation of configuration object presentations consists of two stages: first, defining the attributes that affect the presentation, and then the generation itself. You can use the following object manager event handlers for this: PresentationFieldsGetProcessing and PresentationGetProcessing.

  1. In Designer, in the configuration object tree, right-click the MaterialsAndServices catalog and click Open manager module.
  2. Add the procedures from listings 10.1 and 10.2 to the manager module.

    Listing 10.1. Procedure PresentationFieldsGetProcessing()

    Procedure PresentationFieldsGetProcessing(Fields, StandardProcessing)
     
        StandardProcessing = False;
        Fields.Add("Description");
        Fields.Add("MaterialServiceType");
     
    EndProcedure

    Listing 10.2. Procedure PresentationGetProcessing()

    Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing) 
     
        StandardProcessing = False;
        If ValueIsFilled(Data.MaterialServiceType) Then
            Presentation = Data.Description + " (" + Lower(String(Data.MaterialServiceType)) + ")";
        Else
            Presentation = Data.Description;
        EndIf;
     
    EndProcedure

Now let us examine this script.

The PresentationFieldsGetProcessing handler describes the attributes that affect the document presentation. First, the handler sets the StandardProcessing parameter to False, and then it adds the required catalog attributes to the Fields array. Note that if StandardProcessing is not set to False, the Fields array contains the attributes used to generate the default object presentation (in this case it is the Description attribute).

The PresentationGetProcessing handler describes the generation of the Presentation parameter based on the array of fields specified in the previous handler. The data required to generate the presentation is passed in the Data parameter that has Structure type. First, StandardProcessing is set to False, and then the material or service presentation is generated by adding the type enclosed in parentheses to the description. Note that if StandardProcessing is not set to False, the platform attempts to generate the default object presentation based on the data that is passed to the handler.

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.