json - Not able to display the content on the grid dynamically from database -


i want display load form data database , display data grid. while doing task facing 1 problem i.e., unable json response grid empty rows adding grid.

here grid code:

ext.define('test.view.user.predictabilitygrid' ,{ extend: 'ext.grid.panel', alias: 'widget.predictabilitygrid', title: 'predictability grid',  store:'usergrid', height: 200, width: 400, columns: [           {     header: 'sap id',                 dataindex:'userid'           },           {               header: 'name',               dataindex: 'username'               //id: 'gridname'            },           {               header: 'status',               dataindex: 'status'           },           {               header: 'edc name',               dataindex: 'edcname'           },           {               header: 'bhr',               dataindex: 'businesshr'           },           {               header: 'level',               dataindex: 'level'           },           {               header: 'designation',               dataindex: 'designation'           },           {               header: 'resign date',               dataindex: 'dor'           },           {               header: 'doj',               dataindex: 'doj'           },           {               header: 'manager',               dataindex: 'directmanager'           },           {               header: 'indirect manager',               dataindex: 'indirectmanager'           },           {               header: 'quarter',               dataindex: 'quarter'           },           {               header: 'year',               dataindex: 'year'           },           {               header: 'predictability',               dataindex: 'predict'           },           {               header: 'primary reason',               dataindex: 'primary'           },           {               header: 'secondary reason',               dataindex: 'secondary'           },           {               header: 'probable attrition category',               dataindex: 'attrition'           },           {               header: 'criticality',               dataindex: 'criticality'           },           {               header: 'action planned manager(1)',               dataindex: 'action1'           },           {               header: 'action planned manager(2)',               dataindex: 'action2'           },           {               header: 'details',               dataindex: 'details'           },           {               header: 'dependency',               dataindex: 'dependency'           },           {               header: 'remarks',               dataindex: 'remarks'           }],           dockeditems:[{                 xtype: 'toolbar',                 docked:'top',                 height:50,                 items: [{                     text:   'hrapps',                     icon:   'hrapps.jpg'                 },{                         xtype: 'tbfill'                 },{                     itemid:'btnhomegrid',                     text: 'home',                     icon:'home.jpg'                 },{                     itemid:'btnchangegrid',                     text:   'changepassword',                     icon:'changepass.jpg'                 },{                     itemid:'btnlogoutgrid',                     text:'logout',                     icon:'logout.jpg'                 }]             }]     }); 

here grid store:

ext.define('test.store.usergrid', { extend: 'ext.data.store', storeid:'usergrid', autoload: false, alias : 'widget.usergrid', itemid:'usergrid', fields: ['username','userid',          'status',          'edcname',          'businesshr',         'level',          'doj',          'designation',          'directmanager',          'indirectmanager',          'quarter',         'year',          'dor',          'predict',        'primary',          'secondary',             'attrition',             'criticality',             'action1',             'action2',             'details',             'dependency',          'remarks'          ]    }); 

here extjs controller code displaying data grid:

in following code storing data form , getting , displaying grid.

onsavepredict:function(button)     {         var predictabilitydetails = this.getpredictabilityform().getform().getvalues();         var form = button.up('predictability').getform();             ext.ajax.request({                  params : {                 predictdata : ext.encode(predictabilitydetails)             },                 url: 'test/createpredictability',                  success: function(response, options){                 var jsonresponse = ext.decode(response.responsetext);                 panel = button.up('parentpage');                 panel.getlayout().setactiveitem(5);                 form.reset();                 ext.ajax.request({                      params : {                     grid_data : ext.encode(predictabilitydetails)                 },                 url: 'test/creategrid',                 success: function(response, options,record){                     var jsonresponse = ext.decode(response.responsetext);                     //this.getview().get(predictabilitygrid).getstore();                     //alert(jsonresponse.predict.get().username);                     ext.getstore('usergrid').load();                 ext.getstore('usergrid').add(0,jsonresponse.predict);                      /*userstore.insert(0, predictabilitydetails);                        predictabilitydetails.loadrecord(record);                     predictabilitydetails.updaterecord();*/                     }                 });             }             }); 

here json response:

{"predict":[{"predict":"moderately certain","primary":"aaa","secondary":"ccc","attrition":"regretted" ,"criticality":"critical","action1":"permanent","action2":"good","actionstatus":"pending","details":"as" ,"dependency":"sa","remarks":"dsd","username":"supriya","userid":"7164921","status":"inactive","edcname" :"hdc","businesshr":"suresh","level":"l1","doj":"03/05/2015","designation":"intern","directmanager":"sridhar" ,"indirectmanager":"amith","year":"2015","quarter":"q1","dor":""}]}

how make data displayed on grid dynamically database?

first should remove "alias : 'widget.usergrid'" , "itemid:'usergrid'" store. makes no sense. create model bind store , config ajax proxy onto store. call store.load().


Comments