IRdsSortAttributes.Remove

Syntax

Remove:(Index: Integer): Boolean;

Parameters

Index. Index of attribute of sorting that should be removed.

Description

The Remove method removes sorting attribute, which index is passed by the Index parameter.

Example

Executing the example requires a form with buttons named Button1 and Button2, the RdsDictionaryBox1 and the UiRdsDictionary1 component that is a data source of the RdsDictionaryBox1 component. A MDM dictionary is connected to the UiRdsDictionary1 component. Add links to the ExstCtrls, Forms, Metabase and Rds system assemblies.

This example is a handler of the OnClick event for the buttons.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Attr:IRdsAttribute;
Begin
    Attr:= Attrs.FindById("name");
    SAttrs.Add(Attr,True);
    Sorter.Sort(True);
    RdsDictionaryBox1.RefreshElements;        
End Sub Button1OnClick;
    
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Attr:IRdsAttribute;
Begin
    Attr:= Attrs.FindById("test");
    SAttrs.Remove(0);
    SAttrs.Add(Attr,True);
    Sorter.Sort(true);
    RdsDictionaryBox1.RefreshElements;    
End Sub Button2OnClick;

Sub OBJ45736FormOnCreate(Sender: Object; Args: IEventArgs);
Begin
    Dict:= RdsDictionaryBox1.Source.Instance;
    Elems := Dict.Elements;
    Sorter:= Elems.CreateSorter(Elems.Root);
    Attrs := Dict.Dictionary.Attributes;
    SAttrs:= Sorter.Attributes;
End Sub OBJ45736FormOnCreate;

End Class OBJ45736Form;

After executing the example, clicking the Button1 button sorts elements by name and clicking the Button2 button sorts elements by the test attribute.

See also:

IRdsSortAttributes