EasyUI Forum

General Category => General Discussion => Topic started by: fl0 on June 07, 2013, 02:30:59 AM



Title: Tree => getChecked(checked + indeterminate)
Post by: fl0 on June 07, 2013, 02:30:59 AM
Hallo there,

would it be possible to include a function that combines checked and indeterminate in the getChecked function?
In my case i can not "just" merge both results, because the tree is also a dnd tree and i need to know the order.


Title: Re: Tree => getChecked(checked + indeterminate)
Post by: stworthy on June 07, 2013, 06:16:11 AM
Try the code below.
Code:
var n1 = $('#tt').tree('getChecked');	// get checked nodes
var n2 = $('#tt').tree('getChecked', 'indeterminate'); // get indeterminate nodes
var nodes = n1.concat(n2);
console.log(nodes);


Title: Re: Tree => getChecked(checked + indeterminate)
Post by: fl0 on June 13, 2013, 01:43:06 AM
That wouldnt solve my problem.
My problem here is that i need to know the ordering of the tree.

if we define (C) means checked and (U) unchecked. The following tree

(U) A
 |---(C) B
(C) C

would lead to to the following result: B - C - A therefore C comes before A but i need to know that A comes before B


Title: Re: Tree => getChecked(checked + indeterminate)
Post by: stworthy on June 13, 2013, 06:32:23 PM
Please try the updated tree plugin http://www.jeasyui.com/easyui/plugins/jquery.tree.js and then use the code below to retrieve checked and indeterminate nodes.
Code:
var nodes = $('#tt').tree('getChecked', ['checked','indeterminate'];
console.log(nodes)


Title: Re: Tree => getChecked(checked + indeterminate)
Post by: fl0 on June 14, 2013, 02:15:51 AM
Please try the updated tree plugin http://www.jeasyui.com/easyui/plugins/jquery.tree.js and then use the code below to retrieve checked and indeterminate nodes.
Code:
var nodes = $('#tt').tree('getChecked', ['checked','indeterminate'];
console.log(nodes)

Code:
var nodes = $('#tt').tree('getChecked', ['checked','indeterminate']);
returns an empty array.
while
Code:
var nodes = $('#tt').tree('getChecked', ['checked']);
and
Code:
var nodes = $('#tt').tree('getChecked', ['indeterminate']);
works the way it should


Title: Re: Tree => getChecked(checked + indeterminate)
Post by: stworthy on June 14, 2013, 07:36:42 AM
Be sure to include http://www.jeasyui.com/easyui/plugins/jquery.tree.js to your page. Please refer to http://jsfiddle.net/DrGYv/