留言板

how to get all the nodes of aui tree

thumbnail
David Zhang,修改在9 年前。

how to get all the nodes of aui tree

New Member 帖子: 5 加入日期: 14-3-13 最近的帖子
when publish a site(including pages) from staging to alive,there is a site page tree like:
---ALL
---A
-----A1
-----A2
---B
-----B1
-----B2

case 1:selecting no pages from the tree reverts to implicit selection of all pages.
case 2:selecting all pages is the same like case 1.

i want to know how the tree works when A1 is checked but A is not checked,does it mean publishing all page from staging to alive,or only publishing A1.
and code below can not get all the checked nodes,how can i get all the checked nodes ?

treeView.eachChildren(
function(item, index, collection) {
	if (item.isChecked()) {
		var match = REGEX_LAYOUT_ID.exec(item.get('id'));
                if (match) {
			layoutIds.push(
			{
			includeChildren: !item.hasChildNodes(),
			plid: match[1]
			}
		);
	}
   }									
}
thumbnail
Meera Prince,修改在9 年前。

RE: how to get all the nodes of aui tree

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
thumbnail
Jay Trivedi,修改在9 年前。

RE: how to get all the nodes of aui tree

Regular Member 帖子: 109 加入日期: 12-11-24 最近的帖子
Hi,

First try to get the main class and then iterate all the sub-childs


A.all('.<classname>').each(function(item, index, collection) {
 4    if (item.isChecked()) {
 5        var match = REGEX_LAYOUT_ID.exec(item.get('id'));
 6                if (match) {
 7            layoutIds.push(
 8         {
 9            includeChildren: !item.hasChildNodes(),
10            plid: match[1]
11            }
12        );
13    }
14   });
</classname>


In either case if You have a structure like.

Main class <id="mainclass" class="mainclass">
Class1 <id ="class1" class="childclass">
--subclass 1
--subclass 2
Class2 <id ="class1" class="childclass">
--subclass 1
-subclass 2

then code structure could be like this.



A.one('mainclass').all('.childclass').each(function (node) {
  //write your code here
  }
});



Thanks,
Jay Trivedi