PDA

View Full Version : Working with two Stores



redjetfire
20 Sep 2012, 3:44 AM
viewMyTeam: function() {
var store = this.getUsersStore();
store.clearFilter(true);
var teamstore = this.getTeamsStore();
teamstore.clearFilter(true);
var teamdata;
var data;
var user = Ext.getCmp('profStatus').getText();
data = store.getAt(store.findExact('login', user.toLowerCase())).data;
if(data.team != "")
{
var win = Ext.widget('teamview');
teamdata = teamstore.getAt(teamstore.findExact('id', data.team)).data;
var team = Ext.getCmp('team_name');
team.setText(teamdata.teamname.toUpperCase() + " Team");
var a = Ext.getCmp('team_info').down('displayfield');
a.setValue(teamdata.teamleader.toUpperCase());
a = a.next('displayfield').setValue(teamdata.t);
var teamcount = store.filter('team', teamdata.id, true);
var qwerty = store.getCount();
a = a.next('displayfield').setValue(qwerty);
win.down('form');
}


teamdata = teamstore.getAt(teamstore.findExact('id', data.team)).data;

Any one can told me why teamdata is undefined?

Thnx

scottmartin
20 Sep 2012, 5:29 AM
Separate your code and find out what is not resolving.

ex:


var index = teamstore.findExact('id', data.team);
var record = teamstore.getAt(index);
console.log(record);



Scott.