CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Problem with Value of Node.Select in JQDynaTreeOptionsSelect

by Ricardo Muñoz » 29 Jun 2016 22:16

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
You do not have the required permissions to view the files attached to this post.
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42

by Alexander Bulei » 04 Jul 2016 11:11

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.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQDynaTree

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.