I have a ComboBox with a remote json store.
It lets the user type in 3+ characters, then queries, displays list and lets user select one option. When the user selects an option, it uses the Ext.data.Record associated to the selected option to populate other fields elsewhere in the form. This works correctly.
Now I want to be able to pre-populat开发者_JAVA技巧e the said fields, by using the functions that I've already written as part of the combo box. What I have come up with, is to add an "artificial record" to the ComboBox's store, and then force its selection - which would trigger all the right functions and populate the other fields etc..
What I have is this function inside of the ComboBox (I've created a custom one by extending ComboBox):
loadRecord : function( record ){
var data = {
"results":1,
"rows":[
record
]
}
this.store.loadData( data ); // I realize I could just use store.add() instead.
alert( this.store.getCount() ); // returns 1, so the record is in
// Here is where I'd need to make a call to select this record.
}
I've tried this.select() and this.selectByValue() but to no avail. Knowing the record is in the store, what is the right way to select it from code?
Thank you in advance.
did you try combo.fireEvent('click', combo, record, index)
?
How about this:
record = this.store.getAt(1);
精彩评论