Jul 18, 2011, 8:05 PM
How to put checkbox in the treeview with javascript
Hi,
I am working with the component Drag and Drop - Grid to Tree, carry the data returned from the database and render the treeview dynamically, when I select a row of the grid to move to the Tree that line must be rendered with a checkbox.
Below is the javascript code that has the component:
I've tried adding several lines of code in javascript that caused them to the line that I sent to the treeview drag and drop to render the checkbox but I can not follow the examples below I have used:
e.dropNode [0]. childNodes.Checked == true;
e.dropNode [0]. Checked == true;
e.Checked == true;
I tried using this way, because I assumed that the Checked property of the treeview item is indicating that it will have a checkbox or not, and it is immaterial whether the property is True or False, if the property is in the field setada check will appear.
I am working with the component Drag and Drop - Grid to Tree, carry the data returned from the database and render the treeview dynamically, when I select a row of the grid to move to the Tree that line must be rendered with a checkbox.
Below is the javascript code that has the component:
var beforenodedrop = function (e) {
if (Ext.isArray(e.data.selections)) {
e.cancel = false;
e.dropNode = [];
var rec;
for (var i = 0; i < e.data.selections.length; i++) {
rec = e.data.selections[i];
e.dropNode.push(this.loader.createNode({
text: rec.get("NomeRazao"),
leaf: true
}));
}
return true;
}
}
If anyone can help thank you.I've tried adding several lines of code in javascript that caused them to the line that I sent to the treeview drag and drop to render the checkbox but I can not follow the examples below I have used:
e.dropNode [0]. childNodes.Checked == true;
e.dropNode [0]. Checked == true;
e.Checked == true;
I tried using this way, because I assumed that the Checked property of the treeview item is indicating that it will have a checkbox or not, and it is immaterial whether the property is True or False, if the property is in the field setada check will appear.
Last edited by kami; Jul 20, 2011 at 1:15 PM.