by ajax
call data fetched server problem response should load in jqgrid
not loading. in var dataajax = jdata.responsetext;
dataajax
received data server.
whats wrong that. please help
$(document).ready(function(){ var resdata = ""; $(".btnload").click((function(){ resdata = $.ajax({ type : "post", url: "/accountui/dataflow/accountdetails.html", datatype: "json", success: functioin(jdata){ var dataajax = jdata.responsetext; return dataajax; } }); }); var griddata = new array(); griddata = resdata; jquery("#ajgrid").jqgrid({ datatype: "json", height: 250, colnames:['accid','accname', 'accbranch'], colmodel:[ {name:'accid',index:'accid', width:60, sorttype:"int"}, {name:'accname',index:'accname', width:90}, {name:'accbranch',index:'accbranch', width:100} ], multiselect : true, caption : "account grid" }); for(var i=0;i<=griddata.length;i++) jquery("#ajgrid").jqgrid('addrowdata',i+1,griddata[i]); });
there misunderstanding datatype: "json"
means. works url
option. jqgrid makes ajax request , filled returned server data in grid. if don't implemented server side paging should add additionally loadonce: true
option grid.
so hope need is: 1) remove manual $.ajax
call; 2) remove loop fill grid using addrowdata
; 3) add following options jqgrid:
url: "/accountui/dataflow/accountdetails.html", mtype: "post", loadonce: true, gridview: true, autoencode: true
i recommend additionally replace height: 250
height: "auto"
. depend on exact format of returned data need add jsonreader
properties jqgrid interpret server response correctly. jqgrid automatically detect format of returned data.
Comments
Post a Comment