java - How to display nested JSON object in grid panel? -
my code store have display in grid
var store = new ext.data.jsonstore( { name: 'approverlist', autoload: true, url: 'json/loginlogout.do?uid=' + userldapid + '&startdate=' + selectedstartdate + '&enddate=' + selectedenddate, root: 'loginandlogouttime', fields: ['employeeid', 'fullname', 'email', {name: 'weekdate', type: 'string', mapping: 'swipecardinfo[0].weekdate'}, {name: 'dayofweek', type: 'string', mapping: 'swipecardinfo[0].dayofweek'}, {name: 'intime', type: 'float', mapping: 'swipecardinfo[0].intime'}, {name: 'outtime', type: 'float', mapping: 'swipecardinfo[0].outtime'}, {name: 'totalhours', type: 'float', mapping: 'swipecardinfo[0].totalhours'}, {name: 'attendencestatus', type: 'string', mapping: 'swipecardinfo[0].attendencestatus'}, ], listeners: { load: function(store, records, options) { alert("store"); alert("store" + store.gettotalcount()); } } }); my grid code:
var grid = new ext.grid.gridpanel({ width: 1250, height: 500, title: 'view login , logout details', store: store, trackmouseover: false, disableselection: true, loadmask: true, // grid columns columns: [{ id: 'ldapuid', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "employee id", dataindex: 'employeeid', width: 50, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "employee name", dataindex: 'fullname', width: 50, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "employee email", dataindex: 'email', width: 100, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "date[dd-mm-yyyy]", dataindex: 'weekdate', width: 50, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "day of week", dataindex: 'dayofweek', width: 50, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "in time", dataindex: 'intime', width: 100, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "out time", dataindex: 'outtime', width: 100, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "total hours", dataindex: 'totalhours', width: 25, sortable: true }, { id: 'topic', // id assigned can apply custom css (e.g. .x-grid-col-topic b { color:#333 }) header: "attendence status", dataindex: 'attendencestatus', width: 50, sortable: true }], // customize view config viewconfig: { forcefit: true, enablerowbody: true, getrowclass: function(record, rowindex, p, store) { if (this.showpreview) { p.body = '<p>' + record.data.excerpt + '</p>'; return 'x-grid3-row-expanded'; } return 'x-grid3-row-collapsed'; } }, // paging bar on bottom bbar: new ext.pagingtoolbar({ pagesize: 25, store: store, displayinfo: true, displaymsg: 'displaying topics {0} - {1} of {2}', emptymsg: "no topics display", items: [ '-'] }) }); my json format this:
{"totalcount": 1,"loginandlogouttime": [{ "departmentid": 0, "swipecardinfo": [ { "transationtype": null, "attendencestatus": "weekend", "intimevsouttime": [ "<td> - </td><td> - </td>" ], "totalhours": 0.0, "intime": null, "outtime": null, "weekdate": "05 april 2015", "dayofweek": "sunday" },} how can nested json object in grid panel? not able understand that. in page displaying employeeid fullname , email swipecardinfo object not being displayed.
Comments
Post a Comment