Page 1 of 1

Key value

PostPosted: 21 May 2015 15:40
by etwoss
Hi

Your demo shows:

Code: Select all
 JQDynaTree.ActivateNode('JQDYNATREEFRAME1_2_3_1');


How to get to the key of a node?

I fill the tree with this code:

Code: Select all
  for i := 0 to ProductCatalog.Items.Count - 1 do
  begin
    ProductCataLogItem := ProductCatalog.Items[i] as TWebProductCatalogItem;

    if (LastProductTypeDescription <> ProductCatalogItem.ProductTypeDescription) or (First) then
    begin
      First := False;
      ProductDescriptionTreeNode:= JQDynaTree.Nodes.Add;
      ProductDescriptionTreeNode.Title := ProductCataLogItem.ProductTypeDescription;
      ProductDescriptionTreeNode.IsFolder:= True;
      LastProductTypeDescription := ProductCatalogItem.ProductTypeDescription;
    end;

    if (LastVendorID <> ProductCatalogItem.VendorID) then
    begin
      VendorTreeNode:= ProductDescriptionTreeNode.Children.Add;
      VendorTreeNode.Title:=  ProductCatalogItem.VendorDescription;
      VendorTreeNode.IsFolder:= True;

      LastVendorID := ProductCatalogItem.VendorID;
    end;

    TreeNode:= VendorTreeNode.Children.Add;
    TreeNode.Title:=  ProductCatalogItem.ProductDescription;
    TreeNode.UniqueName := IntToStr(ProductCatalogItem.ProductID);

  end;


Eric

Re: Key value

PostPosted: 21 May 2015 15:46
by Alexander Bulei
Hi Eric,

Keep checking the demo...

Best Regards.

Re: Key value

PostPosted: 22 May 2015 07:37
by etwoss
Hi

Of course I did, looked in HTML page source, found exact the same name for the component, so tried

JQDynaTree.ActivateNode('JQDYNATREEFRAME1_0_0_0'); which is a valid tree value

My searchcode:

Code: Select all
  Found := False;
  for i := 0 to  JQDynaTree.Nodes.Count - 1 do
  begin
    ProductTypeTreeNode := JQDynaTree.Nodes[i];

    for j := 0 to ProductTypeTreeNode.Children.Count - 1 do
    begin
      VendorTreeNode := JQDynaTree.Nodes[i].Children[j];

      for k := 0 to VendorTreeNode.Children.Count - 1 do
      begin
        TreeNode := JQDynaTree.Nodes[i].Children[j].Children[k];
        if (pos(IWCGJQEdit1.Text, TreeNode.Title) > 0) then
        begin
         // TreeNode.Activate := True;
         Key := 'JQDYNATREEFRAME1_' + IntToStr(i) + '_' + IntToStr(j) + '_' + IntToStr(k);
         Codesite.Send('Key', key);
         JQDynaTree.ActivateNode(Key);
         JQDynaTree.SelectNode(Key);
         Found := True;
         Break;
        end;
      end;

      if (Found) then
        Break;
    end;

    if (Found) then
      Break;

  end;


Re: Key value

PostPosted: 22 May 2015 09:09
by etwoss
Hi

With a little luck and Codesite i found it.

OnFocus showed me the params. One of them is 'nodeKey'
When i gave the node a UniqueName , the Nodekey is that UniqueName.
If not the nodeKey for me is (example): JQDYNATREEIWFORMDASHBOARDUSERORDER_0_0

Eric

Re: Key value

PostPosted: 22 May 2015 15:27
by etwoss
Hi

Is this the right approach?

Eric

Re: Key value

PostPosted: 22 May 2015 18:09
by Alexander Bulei
Hi Eric,

Is this the right approach?


Yes, all nodes should have the unique id/name, so if you not fill the uniquename it will generated automatically.

Best Regards.