javascript - how jquery handles map? -
iam doing spring mvc project maven..i want display jqxgrid items..am getting item through map..the problem ,i got grid no items displaying..the data return controller map..how jquery handles returning map ??
my jquery code
$(document).ready(function () { var source = { datatype: "json", type:"get", url: "account/list", datafields: [ { name: 'id' }, { name: 'periodname' }, { name: 'startdate' }, { name: 'enddate' }, { name: 'isactive' } ], sort: function () { $("#jqxgrid").jqxgrid('updatebounddata', 'sort'); }, id: 'id' }; var dataadapter = new $.jqx.dataadapter(source, {loaderror: function (xhr, status, error) { } }); $("#jqxgrid").jqxgrid( { width: 800, source: dataadapter, pageable: true, autoheight: true, columns: [ { text: 'period name', datafield: 'periodname', width: 200 }, { text: 'start date', datafield: 'startdate', width: 200 }, { text: 'end date', datafield: 'enddate', width: 200 }, { text: 'active', datafield: 'isactive', width: 200 } ] }); $("#addrowbutton").jqxbutton({ theme: theme }); $("#deleterowbutton").jqxbutton({ theme: theme }); $("#updaterowbutton").jqxbutton({ theme: theme }); // initialize jqxgrid // }); }); </script>
controller
@controller @requestmapping(value="/account") public class accountscontroller { @autowired private accountservice accountservice; @autowired private accountdao accountdao; @requestmapping(value="/list",method = requestmethod.get,produces="application/json") @responsebody public map<string, object> getaccounts(map<string, object> map) { map.put("all_item_issue_headers", accountdao.getaccounts()); system.out.println(map); return map; } }
waiting response..thanks
the response json. key it's all_item_issue_headers
.
var response = yourjson; // map var array = yourjson[all_item_issue_headers]; // array
Comments
Post a Comment