Title: show the parent node also Post by: catpaw on January 09, 2014, 02:03:37 PM according to this example
http://www.jeasyui.com/tutorial/tree/tree2.php If I have this structure: -> Node 1 -> Node 2 --> Node 2.1 --> Node 2.2 --> Node 2.3 -> Node 3 -> Node 4 How I can show only the node 2 and their children? -> Node 2 --> Node 2.1 --> Node 2.2 --> Node 2.3 Following the demo I just get: -> Node 2.1 -> Node 2.2 -> Node 2.3 I need to show Parent Node also Title: Re: show the parent node also Post by: stworthy on January 09, 2014, 05:30:59 PM Use 'loadFilter' function to customize what data you want.
Code: <script> Title: Re: show the parent node also Post by: catpaw on January 09, 2014, 06:51:01 PM hi, stworthy
sorry but is my first tree :D if the data were also: <script> var data = [{ id:100, text:'Node 1' },{ id:200, text:'Node 2', children:[{ id:210, text:'Node 2.1' },{ id:220, text:'Node 2.2' },{ id:230, text:'Node 2.3' }] },{ id:300, text:'Node 3' },{ id:400, text:'Node 4' }]; </script> then loadfilter: loadFilter:function(nodes){ return ??? } how can I call for the ID node 200 and their children thank for your time Title: Re: show the parent node also Post by: stworthy on January 12, 2014, 05:36:55 PM Here is the simple implementation to find a node by any property.
Code: function findBy(data, param, value){ Some usage examples: Code: var node = findBy(data, 'id', 200); // find by id Title: Re: show the parent node also Post by: catpaw on January 13, 2014, 08:58:11 AM very good stworthy
this function will help me a lot thanks |