View Full Version : Using Jsonp in proxy in model in extjs 4.2.1

5 Jun 2013, 9:01 PM
I am calling rest web service from sencha extjs 4.2.1 in model .My model is

Ext.define('AM.model.User', {
extend: 'Ext.data.Model',
fields: [
{name: 'subCategoryName', type: 'string'},
type : 'jsonp',
callbackKey: 'callback',

url: '',
headers: {
'Accept': 'application/json'
callback: function( data ) {
console.log("callback" + data);
listeners: {
load: function() {
console.log("in load");

reader: {
type: 'json',


From Firebug :
My request Url is

Response is
Ext.data.JsonP.callback1({"listException":"false","listSize":"5","nextPage":"false","pageNumber":"0","subcategory":[{"isException":"false","categoryId":"1","categoryName":"Solutions","productSize":"4","subCategoryDescription":"Oracle Consulting","subCategoryId":"1","subCategoryName":"Oracle Consulting"},{"isException":"false","categoryId":"1","categoryName":"Solutions","productSize":"5","subCategoryDescription":"PeopleSoft","subCategoryId":"2","subCategoryName":"PeopleSoft"},{"isException":"false","categoryId":"1","categoryName":"Solutions","productSize":"0","subCategoryDescription":"Credo offers a full range of global strategic staffing and project staffing solutions covering fulltime, contract, contract-to-hire and executive search services.Around 90 to 100 percent of the companies today are gaining a competitive advantage by seeking expertise from third-party professionals. Credotech has years of experience in providing IT Staffing solutions to a variety of industries and markets worldwide. Many companies manage their IT projects internally and need talented people to quickly build their skill needs and hit the ground running.","subCategoryId":"3","subCategoryName":"Strategic Staffing"},{"isException":"false","categoryId":"1","categoryName":"Solutions","productSize":"0","subCategoryDescription":"Credo Technology Solutions develops software solutions using the latest Java and Microsoft technologies in addition to enhancing or modernizing existing legacy systems running on Mainframe technologies. These solutions include the development of new applications, features, extensions, enhancements, interfaces, and upgrades for existing and emerging business solutions.","subCategoryId":"4","subCategoryName":"Software Development"},{"isException":"false","categoryId":"1","categoryName":"Solutions","productSize":"0","subCategoryDescription":"Credo has been implementing government solutions with Oracle products for years and this has given us a full understanding of the unique requirements of the government IT solutions. The government organizations being public sector units has pressure is on to improve workflow and ensure the highest level of efficiency in all practices. Government organizations are held to a higher standard than commercial enterprises, with expectations of perfectly accurate information and standardized protocols.","subCategoryId":"5","subCategoryName":"Government Solutions"}],"totalRecords":"5"})

But I am not seeing any data in grid view.

Rest Web service method is


public JSONWithPadding getSubCategorylist(@PathParam("categoryId") int categoryId,@PathParam("userId")int userId,@PathParam("pageNumber") int pageNumber, @QueryParam("callback") String callback)

SubCategoryList subCategory = new SubCategoryList();
SubCategoryEntityHandler handler = new SubCategoryEntityHandler();
try {
subCategory = handler.getSubCategoriesList(categoryId,pageNumber);

return new JSONWithPadding(
new GenericEntity<SubCategoryList>(subCategory) {

} catch (Exception e) {
return new JSONWithPadding(
new GenericEntity<SubCategoryList>(subCategory) {
}, "callback");

My store is

Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',

config: {
model: 'AM.model.User',


My view is

Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias: 'widget.userlist',

title: 'All Users',
store: 'Users',

initComponent: function() {

this.columns = [
{header: 'Subject', dataIndex: 'subCategoryName', flex: 1},



There is no error in console. But I am not seeing any data in grid.
How to resolve this?

7 Jun 2013, 10:30 AM
Try with root instead of rootProperty on your reader.