CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Key value

by etwoss » 21 May 2015 15:40

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
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Alexander Bulei » 21 May 2015 15:46

Hi Eric,

Keep checking the demo...

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

by etwoss » 22 May 2015 07:37

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;

You do not have the required permissions to view the files attached to this post.
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 22 May 2015 09:09

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
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 22 May 2015 15:27

Hi

Is this the right approach?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Alexander Bulei » 22 May 2015 18:09

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.
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

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.