Remove:(Index: Integer): Boolean;
Remove(Index: Integer): boolean;
Index. Index of attribute of sorting that should be removed.
The Remove method removes sorting attribute, which index is passed by the Index parameter.
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.
Executing the example requires a form with buttons named button1 and button2, the RdsDictionaryBoxNet1 component, and the UiRdsDictionaryNet1 component that is a data source of the RdsDictionaryBoxNet1 component. An MDM dictionary is connected to the UiRdsDictionaryNet1 component. Add links to the Forms, Metabase and Rds system assemblies.
This example is a handler of the OnClick event for the buttons.
Imports Prognoz.Platform.Interop.Rds;
…
Public Partial Class OBJ50087Form: Prognoz.Platform.Forms.Net.ForeNetForm
Dict: IRdsDictionaryInstance;
Elems: IRdsDictionaryElements;
Sorter: IRdsElementsSorter;
Attrs: IRdsAttributes;
SAttrs: IRdsSortAttributes;
Public Constructor OBJ50087Form();
Begin
InitializeComponent();
End Constructor;
Private Sub button1_Click( sender : System.Object; e : System.EventArgs );
Var
Attr: IRdsAttribute;
Begin
Attr := Attrs.FindById("name");
SAttrs.Add(Attr, True);
Sorter.Sort(True);
RdsDictionaryBoxNet1.CtrlBox.RefreshElements();
End Sub;
Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
Var
Attr: IRdsAttribute;
Begin
Attr := Attrs.FindById("test");
SAttrs.Remove(0);
SAttrs.Add(Attr, True);
Sorter.Sort(true);
RdsDictionaryBoxNet1.CtrlBox.RefreshElements();
End Sub;
Private Sub OBJ50087Form_Shown(sender: System.Object; e: System.EventArgs);
Begin
Dict := RdsDictionaryBoxNet1.CtrlBox.Source.Instance;
Elems := Dict.Elements;
Sorter := Elems.CreateSorter(Elems.Root);
Attrs := Dict.Dictionary.Attributes;
SAttrs := Sorter.Attributes;
End Sub;
End Class;
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: