Author Topic: Trying to get json response data into grid  (Read 5603 times)

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Trying to get json response data into grid
« on: April 21, 2014, 10:31:52 am »
Hi,can any one help me !!  i am facing problem while setting json ajax response into pqGrid, i am able to see the json array response in the correct json format as i  see while giving an alert..Here is my code snippet

 
$.ajax({
       type : "get",   
      
       url: "/employee.htm",
      cache: false,            
      success: function(response){
         alert(response);

          $("#datagrid").jqGrid({
              contentType: "application/json; charset=utf-8",
              datatype: "json",
              data:response,
              colNames:['description','standard_voyage1', 'standard_voyage2', 'standard_voyage3','id'],
              colModel:[
             {name:'id',index:'id', key:true, width:100,editable:true},
             {name:'description',index:'description', width:100,editable:true},
                  {name:'standard_voyage1',index:'standard_voyage1', width:100,editable:true},
                  {name:'standard_voyage2',index:'standard_voyage2', width:100,editable:true},
                  {name:'standard_voyage3',index:'standard_voyage3', width:100,editable:true}
                 
              ],
              rowNum:10,
              rowList:[6,3],
              loadonce: true,
              pager: '#navGrid',
              sortname: 'id',
              sortorder: "asc",
              emptyrecords: "Tidak ada data",
              height: "auto", //210,
              viewrecords: true,
              width:600,
              jsonReader : {
                  root: "rows",
                  page: "page",
                  total: "total",
                  records: "records",
                  repeatitems: false,
                  cell: "cell",
                  id: "id"
            },
              onSelectRow: function(id) {
                  var getID = $(this).jqGrid('getCell', id, 'id');
              },
             
              caption:"JQ GRID"
          });
« Last Edit: April 21, 2014, 10:36:44 am by bsolteam »