treegrid点击小箭头才可伸缩,不方便;
function drawtreegrid(data,id,filter,sort){
var col=[];
var arrdata=typeof data.rows!=='object' ? JSON.parse(data.rows):data.rows;
for(var index in arrdata[1]){
if(index!=='id' && index!=='_parentId'){
col.push({'field':index,'title':index,'width':100,'sortable':sort});
}
};
$('#'+id).treegrid({
data:data,
//singleSelect: true,
rownumbers: true,
//showFooter: false,
//fitColumns: true,
//remoteSort:false,
idField: 'id',
treeField: col[0]['field'],
columns:[col],
onClickCell:function(a,b){
if(a==col[0]['field']){
if(b.state=='open'){
$('#'+id).treegrid('collapse',b.id);
}
else {
$('#'+id).treegrid('expand',b.id) ;
}
}
else{
return;
}
}
});
};