PDA

View Full Version : Change the tab panel dynamically according to the store load



mayurid
17 Sep 2010, 3:10 AM
hi all,

i have 2 tab panels, i am having a search option in tab panel with two different forms,In that when the page is loaded the previous search s are shown in fields, its working correctly. now i want the tab panel to change according to the value specified in the load.
this id the store:

var ds1 = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({ //pruneModifiedRecords: true,
url: 'saved_search.php',
method: 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'results',
id: 'alert_detail_id',
fields: ['types', 'category_name']
}),


listeners: {
load: function (thisDS,records,options)
{
if (this.reader.jsonData.success) {
if (records.length > 0) {
Ext.getCmp('search_form').getForm().loadRecord(records[0]);
}
}
}
}
});

the json format:
({"results":[{"category_name":"c1","types":"types:","search typr":"Basic search"}],"success":"true"})If the search type is basic search the basic tab panel should be active and vice cersa for advanced panel please see the image for details22458

jay@moduscreate.com
21 Sep 2010, 4:37 AM
Well you're half way there. Why not inspect the contents of the record and set the active tab accordingly.