Page 1 of 1

Problem with Value of Node.Select in JQDynaTreeOptionsSelect

PostPosted: 29 Jun 2016 22:16
by Ricardo Muñoz
The problem is that in JQDynaTreeOptionsSelect event the value of Node.Select is diferent when the user select/unselect (check/uncheck) the node clicking on the checkbox on the web page than when the code call DynaTree.SelectNode(...). In the first case, Node.Select is False if the checkbox was unchecked and the user check it, ie, Node.Select has the value prior to the user interaction. But in the second case, Node.Select has the value after the change. It seems that DynaTree.SelectNode(...) first asign the value to Node.Select an then call the event but in the web interaction the call to the event is earlier than assign the value to Node.Select.

In the attachment there is an example in which the event JQDynaTreeOptionsSelect is used to check/uncheck a mirror DynaTree by check/uncheck nodes in the original dynatree. If the user check or uncheck nodes in the web page, all is OK. But if he use the button (Select/unselect Node 3) that calls DynaTree.SelectNode(...) the mirror node.select has an incorrect value.

TIA,
Ricardo

Re: Problem with Value of Node.Select in JQDynaTreeOptionsSe

PostPosted: 04 Jul 2016 11:11
by Alexander Bulei
Hi Ricardo Muñoz,

It's happens, because of "outside" call, in this button select/unselect.
If you debug, you can notice, when button is clicked, the Node.Select is already updated, and this code:

Code: Select all
not Node.Select


will toggle the mirror tree...

So, for this purpose, we have added the new internal browser parameter, which will tell you the action (select or unselect).

Will be available in next build.

For now, you can add the internal browser parameter by yourself:

delphi code
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
var
TreeNode: TIWCGJQDynaTreeNode;
i: integer;
begin
with IWCGJQDynaTree.JQDynaTreeOptions.OnSelect.BrowserParams.Add do
begin
ServerName:= 'select';
BrowserScript:= 'flag';
end;
...


On button click:

delphi code
procedure TIWForm1.IWCGJQDynaTreeJQDynaTreeOptionsSelect(Sender: TObject; AParams: TStringList);
var
JQDTree, JQDTree2: TIWCGJQDynaTree;
Node: TIWCGJQDynaTreeNode;
LDoSelect: Boolean;
begin
LDoSelect:= StrToBool(AParams.Values['select']);
Node := IWCGJQDynaTree.Nodes.ItemsByUniqueName[AParams.Values['nodeKey']];
IWCGJQDynaTreeMirr.SelectNode(Node.UniqueName, LDoSelect);
end;


Best Regards.