Please help me out in the below mentioned situation;
My java web application uses JSON as data-interchange format. While running; firebug(firefox) shows the response as well as JSON data as expected; but the grid is not updating as expected rather it comes blank. Below are the store and grid definition;
//Grid & Store definition
var searchResultStore = Ext.create('Ext.data.JsonStore', {
model : 'BookModel',
proxy : {
type : 'ajax',
reader : {
totalProperty : 'results',
type : 'json',
root : 'data'
}
},
autoLoad : true
});
Ext.define('Library.SearchBookGrid', {
extend : 'Ext.grid.Panel',
alias : 'widget.SearchBookGrid',
id : 'searchBookGrid',
title : 'Books',
closable : true,
initComponent : function() {
this.store = searchResultStore;
this.columns = [ {
xtype : 'gridcolumn',
dataIndex : 'title',
text : 'Title'
}, {
xtype : 'gridcolumn',
dataIndex : 'authorName',
text : 'Author'
} ];
this.callParent(arguments);
}
});
There is a BOOK SEARCH ExtJS form; which calls a URL (/MyLibrary/Books?action=6) & the search form values are submitted as JSONDATA. The search result is assigned as to the store (searchResultStore) follows;
Ext.Ajax.request({
url : '/MyLibrary/Books?action=6',
headers: {'Content-Type':'application/json; charset=utf-8'},
jsonData : Ext.JSON.encode(form.getValues()),
params:{
action : 6
},
method : 'POST',
success : function(response, request) {
searchResultStore.loadData(Ext.JSON.decode(response.responseText));
},
failure : function(results, request) {
Ext.Msg.alert("Search..", "Please try again...!!");
},
});
Did I miss anything or i am wrong in this codes......please help....!!!!
Thanks in advance...!!