Home > Back-end >  DEV CXTREELIST for several days. Great god help
DEV CXTREELIST for several days. Great god help

Time:09-23

Just use Dev controls, use to Dcxtreelist added as shown in figure the demo,, but how to traverse to get my valuse value, that is the back of the Numbers

CodePudding user response:

CodePudding user response:

Write a demo which god give me a look

CodePudding user response:

CxTreeList1. The Clear;
CxTreeList1. OptionsView. CheckGroups:=true;
CxTreeList1. Root. CheckGroupType:=ncgCheckGroup;

Try
QryParent. DisableControls;
With qryParent do
The begin
The Close;
SQL. Text:='Select * from R_Permission where PARENTID=' '0' ';
The Open;
QryParent. First;
While not qryParent. Eof do
The begin
RootNode:=cxTreeList1. Add;
RootNode. CheckGroupType:=ncgCheckGroup;
RootNode. Values [0] :=qryParent FieldByName (' ID '.) AsString + ' '+ qryParent. FieldByName (' name'). AsString;
RootNode. Values [1] :=qryParent FieldByName (' ID '.) AsString;
//RootNode. ImageIndex:=0;
//RootNode. Enabled:=False;

QryChild. DisableControls;
QryChild. Close;
QryChild. SQL. Text:='Select * from R_Permission where PARENTID=: PARENTID';
QryChild. The Parameters. ParamByName (" PARENTID "). The Value:=qryParent. FieldByName (' ID '.) AsString;
QryChild. Open;
//Filtered:=False;
//Filter:="ID=" + QuotedStr (qryChild. FieldByName (' ID '.) AsString) are identical.
//Filtered:=True;
QryChild. First;
While not qryChild. Eof do
The begin
SonNode:=RootNode. AddChild;
SonNode. Values [0] :=trim (qryChild. FieldByName (' ID '.) AsString) are identical + ' '+ qryChild. FieldByName (' name'). AsString;
SonNode. Values [1] :=qryParent FieldByName (' ID '.) AsString;
SonNode. ImageIndex:=1;
QryChild. Next;
end;
QryChild. EnableControls;

QryParent. Next;
end;
QryParent. EnableControls;
end;
The finally
CxTreeList1. FullExpand;
end;

CodePudding user response:

Your SQL and prone to problems

CodePudding user response:

//is according to the tree structure to store the Items, simply iterate through the Items and get only the first layer of the node
//TcxTreeList contains a AbsoluteItems, preserves the order of the structure of the node
For I:=0 to cxTreeList1 - & gt; Do AbsoluteCount - 1
ShowMessage (cxTreeList1 AbsoluteItems [I] Texts [1]).

CodePudding user response:

Fifth floor truth!!!!!!
  • Related