留言板

Aui Tree View -Get all selected value in a tree view

thumbnail
mohammad azaruddin,修改在9 年前。

Aui Tree View -Get all selected value in a tree view

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
Hi all how to get all selected checkbox value of child in a tree view...?
I can able to get the last selected checkbox value
And how to set value for a checkBox

<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %>
<div id="myTreeView" style="border-right:1px solid #D9DADB;"></div>
<aui:script>


AUI().use(
		  'aui-tree-view',
		  function(A) {
		    new A.TreeViewDD(
		      {
		        boundingBox: '#myTreeView',
		        children: [
		          {
		            children: [
		              {label: 'Learn Spanish', leaf: true, type: 'task'},
		              {label: 'Learn Salesforce', leaf: true, type: 'task'},
		              {label: 'Hibernate Course', leaf: true,  type: 'task'},
		              {label: 'Finance &amp; Magaement', leaf: true, type: 'task'},
		              {label: 'More', leaf: true, type: 'task' , color: 'blue'}
		              
		            ],
		            expanded: true,
		            label: 'Title',
		            type: 'task'
		          }
		        ],
		        after: {
			lastSelectedChange: function(event){
			alert("LAST SELECTED VALUE--&gt;"+event.newVal.get('label'));
					}
				}
		      }
		    ).render();
		  }
		);			

</aui:script>

thumbnail
mohammad azaruddin,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
HI all

Any solution...?
thumbnail
Meera Prince,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
Hi

Find the parent element which wrap the all check box values

try as follows


A.all('input[type=checkbox]').each(function (node) {
if (node.getAttribute('checked')==''checked') {

}
});

reference

http://www.jsrosettastone.com/
thumbnail
mohammad azaruddin,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
Hi prince Unable to get the result..Is that is working for you...?
I notice that there is no cheked attribute in that check box and when i check the check box class tree-node-checked append to the parent div
thumbnail
mohammad azaruddin,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
HI meera

I can able to get if the node is checked(node.get('checked')) but unable to get the other details about the node ie (node.get('label'))

A.all('input').each(function (node) {
alert(node.get('label')+" Is checked--"+node.get('checked'));

});
thumbnail
Meera Prince,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
Hi

The check box have label attribute then only it can give man i guess label is not attribute for check box ok.

type , value, name, id are the attributes if you want then you can use your custom attribute as follows i.e. label for your check box.

Like

<input type="checkbox" label="checkbox1" value=""/>


Try this

A.one('#parentNodeWrappedAllCheckBoxes').all('input[type=checkbox]').each(function (node) {
  if (node.getAttribute('checked')=='checked') {
    alert(node.getAttribute('label'))
  }
});


in your case label is not an attribute of check box ok

Regards,
meera prince
thumbnail
mohammad azaruddin,修改在9 年前。

RE: Aui Tree View -Get all selected value in a tree view

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
Madasamy P,修改在7 年前。

RE: Aui Tree View -Get all selected value in a tree view

Junior Member 帖子: 90 加入日期: 16-7-27 最近的帖子
Am I give the label as one variable name contains String value and I want to use loops in tree structure
Madasamy P,修改在7 年前。

RE: Aui Tree View -Get all selected value in a tree view

Junior Member 帖子: 90 加入日期: 16-7-27 最近的帖子
I want looping to displays the muliple file names as label

What can I do for it?