PDA

View Full Version : Help! Data.Ext.Store's in-line data works fine but proxy/json does not



anthoang
18 Jul 2011, 1:41 PM
I'm seriously willing to pay someone to help me with this. -could get me back my lost day-

There is a Kitchen Sink example with a list of names. (Kitchen Sink -> User Interface -> List).
The Kitchen Sink example uses an in-line data to store the list of names. What I'm trying to do is to put this exact same list into a json file and use a proxy to connect to this json file - but it isn't working for me.


Here is the code snipplet where the list of names is put into the Store (this works perfectly fine and the debugger shows 5 data in the ListStore):



Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});

demos.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName')[0];
},
data: [
{firstName: 'Julio', lastName: 'Benesh'},
{firstName: 'Julio', lastName: 'Minich'},
{firstName: 'Tania', lastName: 'Ricco'},
{firstName: 'Odessa', lastName: 'Steuck'},
{firstName: 'Zebra', lastName: 'Evilias'}
]
});




Here is the code snipplet where I use a proxy instead (this does not work and the debugger shows 0 data in the ListStore):



Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});

demos.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName')[0];
},
proxy: {
type: 'ajax',
url : 'ListofNames.json',
reader: {
type: 'json',
root: 'users'
}
}
});


My ListofNames.json file is in the same directory as my index file.
My ListofNames.json file content is as follows:


{
"users":
[
{
firstName: "Julio",
lastName: "Benesh"
},
{
firstName: "Julio",
lastName: "Minich"
},
{
firstName: "Tania",
lastName: "Ricco"
},
{
firstName: "Odessa",
lastName: "Steuck"
},
{
firstName: "Zebra",
lastName: "Evilias"
}
]
}


What is wrong here?
seriously, i got paypal

colworx
18 Jul 2011, 2:10 PM
Does it work in your desktop browser, just not on a mobile device? If so, you may have run into the issue I have: http://www.sencha.com/forum/showthread.php?136086-My-nested-list-doesn-t-showup-on-iPhone-iOS-but-does-work-in-safari

anthoang
18 Jul 2011, 3:29 PM
it does not work in any desktop browser - Safari nor Chrome.

vinayakpanse
19 Jul 2011, 7:43 AM
I have the same problem, When I debug through Fire Fox 5. It does skip the proxy block

proxy:({
type: 'ajax',
url: 'http://localhost:32382/Whatif_Services_C-2.0-SNAPSHOT/res/whatif/getWhatifPortfolios/mk34197',
reader:{
type: 'xml',
root: 'whatIfPortfolio',
}
}),