Forums de discussion

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

thumbnail
mohammad azaruddin, modifié il y a 9 années.

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

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
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, modifié il y a 9 années.

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

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
HI all

Any solution...?
thumbnail
Meera Prince, modifié il y a 9 années.

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

Liferay Legend Publications: 1111 Date d'inscription: 08/02/11 Publications récentes
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, modifié il y a 9 années.

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

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
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, modifié il y a 9 années.

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

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
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, modifié il y a 9 années.

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

Liferay Legend Publications: 1111 Date d'inscription: 08/02/11 Publications récentes
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, modifié il y a 9 années.

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

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
Madasamy P, modifié il y a 7 années.

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

Junior Member Publications: 90 Date d'inscription: 27/07/16 Publications récentes
Am I give the label as one variable name contains String value and I want to use loops in tree structure
Madasamy P, modifié il y a 7 années.

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

Junior Member Publications: 90 Date d'inscription: 27/07/16 Publications récentes
I want looping to displays the muliple file names as label

What can I do for it?