Hello! I read many topics here but there no answer =(
I have such problem:
1. I use treegrid in adjacency model.
2. I get the responce from the server in JSON format.
3. The struct of data such this:
Type1
– Model1
– Model2
– Model3
Type2
– Model6
– Model7
– Model8
…
My TreeGrid:
jQuery(“#purchase_model_list”).jqGrid({
url:'lib/mod_purchase_js.lib.php?ref=model_list&type_ci=”.$type_ci.”',
datatype: “json”,
height: 285,
width: 950,
colNames:['Ðазвание','ID'],
colModel:[
{name:'name',index:'name'},
{name:'id',index:'id', width:65, align:'center', sorttype:'int'}
],
rowNum:50000,
rowTotal: 100000,
loadonce: true,
mtype: “GET”,
rownumbers: false,
rownumWidth: 40,
gridview: true,
pager: '#ppurchase_model_list',
sortname: 'id',
viewrecords: true,
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn : 'name',
multiselect: “true”,
sortorder: “desc”
});
jQuery('#purchase_model_list').jqGrid('navGrid','#ppurchase_model_list',{del:false, add:false, edit:false, search:false, refresh: false});
And my server-side:
$node = (integer)$_REQUEST[“nodeid”];
if( $node >0)
{
$query = “select MODEL_NO as id, MODEL_NAME as descrip
from “._TB_MODELS_.”
where TYPE_NO=”.$node.” and is_archive=0 and CI_TYPE=1″;
$sql2 = mssql_query($query) or die(mssql_get_last_message());
}
else
{
$query = “select TYPE_NO as id, TYPE_NAME as descrip
from “._TB_TYPES_.”
where CI_TYPE=1 and is_real=1 and is_archive=0″;
}
$sql = mssql_query($query) or die(mssql_get_last_message());
$responce->page = 1;
$responce->total = 1;
$responce->records = 10000;
$i=0;
while($row = mssql_fetch_array($sql))
{
$responce->rows[$i]['id']=$row['id'];
$responce->rows[$i]['cell']=array(iconv('cp1251','utf-8',$row[“descrip”]),
$row[“id”],
//'type',
$node>0?1:0,
$node>0?$node:'null',
$node>0?'true':'false',
$node>0?'true':'false',
$node>0?'true':'false'
);
$i++;
}
print json_encode($responce); exit();
My first tree grid loading (everithing ok), I get such data (list of Types; for each item expanded:false, isleaf:false, loaded:flase):
{
“page”:1,
“total”:1,
“records”:10000,
“rows”:[
{“id”:1,”cell”:[“u041au043eu043cu043fu044cu044eu0442u0435u0440″,1,0,”null”,”false”,”false”,”false”]},
{“id”:2,”cell”:[“u041du043eu0443u0442u0431u0443u043a”,2,0,”null”,”false”,”false”,”false”]},
{“id”:3,”cell”:[“u041cu043eu043du0438u0442u043eu0440″,3,0,”null”,”false”,”false”,”false”]},
… ,
{“id”:36,”cell”:[“u0412u043du0435u0448u043du0438u0439 HDD”,36,0,”null”,”false”,”false”,”false”]}
]
}
Ok… I've got the correct list…
Next, I click at any node (for example – id=3) and get the responce from server:
{
“page”:1,
“total”:1,
“records”:10000,
“rows”:[
{“id”:38,”cell”:[“Samsung B2230W”,38,1,3,”true”,”true”,”true”]},
{“id”:53,”cell”:[“u041cu043eu043du0438u0442u043eu0440 LCD”,53,1,3,”true”,”true”,”true”]},
{“id”:54,”cell”:[“u041cu043eu043du0438u0442u043eu0440 CRT”,54,1,3,”true”,”true”,”true”]},
…
{“id”:410,”cell”:[“Philips 40PFL5606H/60″,410,1,3,”true”,”true”,”true”]}
]
}
Ok… It's loaded correctly. I got subnodes for node 3. For each node expanded – true; isleaf – true; isloaded – true.
Then, I'm trying to collapse node 3, but there is no effect. And when I'm trying to expand any other root-node – I get the error:
Uncaught TypeError: Cannot read property 'isLeaf' of undefined; jquery.jqGrid.src.js:10129
Stack:
Uncaught TypeError: Cannot read property 'isLeaf' of undefined jquery.jqGrid.src.js:10129
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top