How display filter item of Dynamic List on List Form by coding

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Feb 29, 2012
Company:

Hi All,

I created filter item of dynamic list on List Form.
I want to show filer item on the List Form by code programming. I don't want manual make it like in the picture.
Please help me!

Here is my code to create FilterItem

Code
UserFilter = List.SettingsComposer.UserSettings.Items.Find(List.SettingsComposer.Settings.Filter.UserSettingID);
UserFilter.Items.Clear();  

// Create filter DeletionMark   
FilterItem = UserFilter.Items.Add(Type("DataCompositionFilterItem"));             
FilterItem.LeftValue = New DataCompositionField("DeletionMark");
FilterItem.Use = true;
FilterItem.ComparisonType = DataCompositionComparisonType.NotEqual;
FilterItem.RightValue = False;

//Display ListSettingsComposerUserSettings
Items.ListSettingsComposerUserSettings.Visible = True;

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Nguyen TH.

You can use the following method:
Add a filter in Designer mode and set it not accessible by user to hide from settings editor.
Find this filter, enable it and set its value.

Because otherwise it will be harder to understand which filters should be deleted when you change the filter value.

Here is the script:

Code
   OwnerField = New DataCompositionField("Owner");
   For Each FilterItem In DictionaryDiscussions.SettingsComposer.Settings.Filter.Items Do
      If FilterItem.ViewMode = DataCompositionSettingsItemViewMode.Inaccessible 
         And FilterItem.LeftValue = OwnerField
         And FilterItem.Use Then
         FilterItem.RightValue = Object.Ref;
      EndIf;
   EndDo;

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
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.