Forum


09:56

26/04/2012

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":["\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440",1,0,"null","false","false","false"]},
{"id":2,"cell":["\u041d\u043e\u0443\u0442\u0431\u0443\u043a",2,0,"null","false","false","false"]},
{"id":3,"cell":["\u041c\u043e\u043d\u0438\u0442\u043e\u0440",3,0,"null","false","false","false"]},
... ,
{"id":36,"cell":["\u0412\u043d\u0435\u0448\u043d\u0438\u0439 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":["\u041c\u043e\u043d\u0438\u0442\u043e\u0440 LCD",53,1,3,"true","true","true"]},
{"id":54,"cell":["\u041c\u043e\u043d\u0438\u0442\u043e\u0440 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:
Stack:
Uncaught TypeError: Cannot read property 'isLeaf' of undefined jquery.jqGrid.src.js:10129
$.jgrid.extend.setTreeNode.each.$.find.css.bind.target jquery.jqGrid.src.js:10129
jQuery.event.dispatch jquery-1.7.1.js:3256
jQuery.event.add.elemData.handle.eventHandle jquery-1.7.1.js:2875
I've broken my brain... =(
Please, help.
15:51

26/04/2012

I don't khow why, but after the second responce all data replaced with new data from responce...
So, what i have:
1. Load grid:
-Type1
-Type2
-Type3
Data:
-Type1
-Type2
-Type3
2. Expand the node:
Grid:
-Type1
--Model1
--Model2
--Model3
--Model4
-Type2
-Type3
Data:
-Model1
-Model2
-Model3
-Model4
So, by clicking at the any type, it can't load any more item, because it can't find the id of clicked item...
Why it replaced all data with new response and don't add it?
Most Users Ever Online: 715
Currently Online:
69 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66