kjcr
9 Nov 2012, 1:22 AM
hello.
I have problem with tree.
I want to set my root and all node checkbox.
in final node have checkbox.
But in root and other node don't have checkbox.
is there any solution about it?
This is my store
var storeTree = Ext.create('Ext.data.TreeStore', {
listeners: {
load:function(option){
},
append: function (thisNode, newChildNode, index, eOpts) {
//console.log(thisNode);
if (!newChildNode.isRoot()) {
newChildNode.set("text", newChildNode.get("text"));
}
}
},
proxy: {
type: 'memory'
},
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}]
});
and this is my tree:)
var tree = Ext.create('Ext.tree.Panel', {
store: storeTree,
rootVisible: false,
useArrows: true,
title: 'Tree',
id:'treeMenu',
split: true,
width: 300,
minWidth: 100,
maxWidth: 500,
height: 100,
minHeight: 60,
listeners : {
checkchange : function(node, checked) {
if(node.data.checked){
isAdd = true;
for(i=0;i<treeSelectNodeList.length;i++){
if(treeSelectNodeList[i] == key) isAdd = false;
}
if(isAdd==true) treeSelectNodeList.push(key);
}else{
for(i=0;i<treeSelectNodeList.length;i++)
if(treeSelectNodeList[i] == key) treeSelectNodeList.splice(i,1);
}
},
itemclick : function(grid, rowIndex, e,r) {
if(rowIndex.data.leaf){
tmp = rowIndex.data.qtitle.split("/");
miCode = tmp[1];
micCode = tmp[2];
Ext.get("rightContent").mask('Data Loading...');
key = rowIndex.data.id;
if(contents_panel.items.items[1].isVisible('activate')){
getXmlCode();
}
if(contents_panel.items.items[2].isVisible('activate')){
getPdfCode();
}
Ext.Ajax.request({
url: setUrlList.xmlTrans.url + '?idx='+key,
method: 'get',
failure : function(response){
Ext.get("rightContent").unmask();
Ext.Msg.alert('Error', 'system error.');
console.log(response);
},
success: xmlTrans
});
}
}
}
});
I have problem with tree.
I want to set my root and all node checkbox.
in final node have checkbox.
But in root and other node don't have checkbox.
is there any solution about it?
This is my store
var storeTree = Ext.create('Ext.data.TreeStore', {
listeners: {
load:function(option){
},
append: function (thisNode, newChildNode, index, eOpts) {
//console.log(thisNode);
if (!newChildNode.isRoot()) {
newChildNode.set("text", newChildNode.get("text"));
}
}
},
proxy: {
type: 'memory'
},
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}]
});
and this is my tree:)
var tree = Ext.create('Ext.tree.Panel', {
store: storeTree,
rootVisible: false,
useArrows: true,
title: 'Tree',
id:'treeMenu',
split: true,
width: 300,
minWidth: 100,
maxWidth: 500,
height: 100,
minHeight: 60,
listeners : {
checkchange : function(node, checked) {
if(node.data.checked){
isAdd = true;
for(i=0;i<treeSelectNodeList.length;i++){
if(treeSelectNodeList[i] == key) isAdd = false;
}
if(isAdd==true) treeSelectNodeList.push(key);
}else{
for(i=0;i<treeSelectNodeList.length;i++)
if(treeSelectNodeList[i] == key) treeSelectNodeList.splice(i,1);
}
},
itemclick : function(grid, rowIndex, e,r) {
if(rowIndex.data.leaf){
tmp = rowIndex.data.qtitle.split("/");
miCode = tmp[1];
micCode = tmp[2];
Ext.get("rightContent").mask('Data Loading...');
key = rowIndex.data.id;
if(contents_panel.items.items[1].isVisible('activate')){
getXmlCode();
}
if(contents_panel.items.items[2].isVisible('activate')){
getPdfCode();
}
Ext.Ajax.request({
url: setUrlList.xmlTrans.url + '?idx='+key,
method: 'get',
failure : function(response){
Ext.get("rightContent").unmask();
Ext.Msg.alert('Error', 'system error.');
console.log(response);
},
success: xmlTrans
});
}
}
}
});