PDA

View Full Version : jsonStore Url behaves strangely



lukesayaw
17 Oct 2010, 10:12 PM
Hi,

I have got a problem. The problem is found in the jsonStore' s url. The store can not load the data from the server if its url property is assigned a particular url . ie. url: 'http://localhost:56484/WebHandler/getallregions.ashx'. But when the url is assigned a json text i.e json.txt, the store can load the data with no problem.

The codes are :
[ASP.NET]
//Data Models
Ext.regModel('regions', {
fields: [{ name: 'CountryID', type: 'int' },
{ name: 'Region', type: 'string' },
{ name: 'RegionID', type: 'int'}]
});


//data store
var regions = new Ext.data.JsonStore({
model: 'regions',
proxy:{
type: "ajax",
url: http://localhost:56484/WebHandler/getallregions.ashx' , //'json.txt
reader: {
type: 'json',
IdProperty: 'RegionID'
}

},
storeID: 'region',
autoLoad: true
});

//Regions list
quickbeds.regionspanel = new Ext.List({
itemId: 'region',
cls:'launchscreen',
title: 'Regions',
align: 'left',
scroll: 'vertical',
tpl: '<tpl for="."><div class="menu"><strong>{Region}</strong><div><string style="display:none"">{RegionID}</strong></div></div></tpl>',
itemSelector: 'div.menu',
singleSelect: true,
store: regions
});

console.log('quickbeds.regionspanel executed');
console.log(quickbeds.regionspanel);

//add listner
quickbeds.regionspanel.addListener("itemtap", onItemTapHandlerForRegions);


function onItemTapHandlerForRegions(list, index, element, evt){

//back button tonen
var dockedItems = panel.getDockedItems();
var header = dockedItems[0];
header.getComponent(0).show();

//titel
//dockedItems[0].setTitle(button.text)

activeItems.push(quickbeds.regionspanel);
var obj = groupingBase.store.getAt(index);
selectedregion = obj;
panel.setCard(quickbeds.propertiespanel);

}

[/ASP.NET]

The json.txt:

[{"CountryID":6,"Region":"QUEENSLAND"},{"CountryID":6,"Region":"NEW SOUTH WALES"},{"CountryID":6,"Region":"VICTORIA"},{"CountryID":6,"Region":"SOUTH AUSTRALIA"},{"CountryID":6,"Region":"TASMANIA"},{"CountryID":6,"Region":"WESTERN AUSTRALIA"},{"CountryID":6,"Region":"NORTHERN TERRITORY"},{"CountryID":6,"Region":"ACT"},{"CountryID":6,"Region":"NORFOLK ISLAND"},{"CountryID":6,"Region":"QUEENSLAND ISLANDS"}]

Any help would be greatly appreciated. Thanks.

evant
17 Oct 2010, 10:24 PM
Please edit your post and put your code in code tags, http://www.sencha.com/forum/misc.php?do=bbcode

People are less likely to help you if they can't read your code.

lukesayaw
17 Oct 2010, 10:58 PM
No worries, I found the error in the url path. Thanks.