PDA

View Full Version : List page reload



lukesayaw
14 Oct 2010, 8:39 PM
Hi,

I wonder if can reload the page at the itemtap event of the list because when the user taps the one of the list items, the id is retrieved and passed to the url of the 2nd item in the list. To repopulate the second list with a new id, i need to reload the list.

Thanks

lukesayaw
14 Oct 2010, 8:48 PM
The list is located within the panel and so how do i reconfigure the panel?

lukesayaw
14 Oct 2010, 9:11 PM
Hi,

Please have a look at the following codes and give me some hits about the problem.

When the user taps the list item initially, the list is populated with the data and the id of the selected list tap is retrieved and passed to the url but the 2nd list item is not populated with data.

Thanks for your help!



var _url = null;

//the panel that contains all destinations
QuickbedsAPI.views.AllDestination = Ext.extend(Ext.CustomFormPanel, {
cls: 'launchscreen',
fullscreen: true,
layout: 'card',
dock: 'center',
scope: this,
activeItem: 0,

initComponent: function () {

//All Destinations Models
Ext.regModel('AllDestinations', {
fields: [{ name: 'CountryID', type: 'int' }, { name: 'Region', type: 'string' }, { name: 'RegionID', type: 'int'}]
});

//SubRegions Models
Ext.regModel('SubRegions', {
fields: [{ name: 'RegionID', type: 'int' }, { name: 'SubRegionID', type: 'int' }, { name: 'SubRegion', type: 'string'}]
});

this.substore = null;

this.store = new Ext.data.JsonStore({
model: 'AllDestinations',
autoLoad: true,
autoDestroy: true,
storeID: 'locationstore',
proxy:
{
type: "ajax",
url: 'http://localhost:56484/WebHandler/getallregions.ashx',
reader: {
type: 'json',
IdProperty: 'RegionID'
}
}

});

//Ext.getBody().mask(false, '<div class="loading">Loading&hellip;</div>')


Ext.apply(this, {
items: [{
xtype: 'fieldset',
title: 'All Destinations',
scope: this,
labelAlign: 'center',
items: [{
itemId: 'regions',
xtype: 'list',
height: 400,
align: 'center',
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,
listeners: {

"itemtap": function (list, index, element, evt) {

var regionid = this.store.getAt(index).get('RegionID');

_url = 'http://localhost:56484/WebHandler/getsubregionsbyregionid.ashx?regionid=' + regionid;
if (regionid != null) {
this.substore = new Ext.data.JsonStore({
model: 'SubRegions',
autoLoad: true,
autoDestroy: true,
storeID: 'subregion',
proxy:
{
type: "ajax",
url: _url,
reader: {
type: 'json',
IdProperty: 'SubRegionID'
}
}

});

}


var rec = list.store.getAt(index),
ct = list.ownerCt.ownerCt,
subregions = ct.getComponent('subregions');

ct.setCard(subregions, 'slide');
subregions.update(rec.data);

}

},

store: this.store

}]


},
{
itemId: 'subregions',
dockedItems: [{
xtype: 'list',
dock: 'top',
height: 700,
align: 'center',
scroll: 'vertical',
tpl: '<tpl for="."><div class="menu"><strong>{SubRegion}</strong><div><string style="display:none"">{SubRegionID}</strong></div></div></tpl>',
itemSelector: 'div.menu',
singleSelect: true,
listeners: {

"itemtap": function (list, index, element, evt) {


}
},

store: this.substore



}]
}]



});




// Ext.getBody().unmask();


QuickbedsAPI.views.AllDestination.superclass.initComponent.call(this);