Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 99250

Programmatically expand and select a child node...

$
0
0

Daniel,

Here is what I have tried based on your example...

01.function_CategoryChooserView_SelectNode(TaxonomyCode)
02.{
03. 
04.    if(TaxonomyCode.length >= 3)
05.    {
06.        debugger;
07. 
08.        varTreeView = $("#CategoryTree").data("kendoTreeView");
09.        varTaxonomyPath = newArray();
10.        varTargetCategory = TaxonomyCode.substring(TaxonomyCode.length, TaxonomyCode.length - 3);
11. 
12.        while(true)
13.        {
14.            varCategoryCode = TaxonomyCode.substring(0, 3);
15. 
16.            if(CategoryCode.length == 3)
17.            {
18.                TaxonomyPath.push(CategoryCode);
19.                TaxonomyCode = TaxonomyCode.replace(CategoryCode, "");
20. 
21.            }
22.            else
23.                break;
24. 
25.        }
26. 
27.        if(TaxonomyPath.length > 0)
28.        {
29. 
30. 
31.            TreeView.expandPath(TaxonomyPath,
32.                function()
33.                {
34.                    debugger;
35. 
36.                    varDataItem = TreeView.dataSource.get(TargetCategory);
37. 
38.                    if(DataItem)
39.                    {
40.                        varNode = TreeView.findByUid(DataItem.uid);
41.                        if(Node.length)
42.                        {
43.                            TreeView.select(Node);
44. 
45.                            ScrollElementToScrollableParent(Node);
46.                        }
47.                    }
48. 
49.                });
50.        }
51.    }
52.}

 

The incoming Taxonomy code is a string consisting of substrings indicating the category of component. For example "001002" is the taxonomy code for a subset of valves like this: "001" = Valves, "002" = Check Valves.  The category ID to expand in this case would be "002" (TargetCategory variable).  The last three digits of the Taxonomy Code is the ID of the leaf level category to be selected.

The problem is that on line 36 above, DataItem is coming back undefined.  The function in lines 31 & 32 is getting called but ExpandPath does not seem to be fetching the data, even if the callback function is being executed.

I have tried this a number of ways, none of which work.


Viewing all articles
Browse latest Browse all 99250

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>