我有一个带有远程JSON存储的组合框。
它允许用户输入3个以上的字符,然后查询、显示列表并允许用户选择一个选项。当用户选择一个选项时,它使用与所选选项关联的ext.data.record来填充表单中的其他字段。这是正确的。
现在,我希望能够通过使用已经作为组合框一部分编写的函数来预先填充上述字段。我想到的是在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.
}
我试过了。select()和this.selectbyvalue(),但是没有用。知道存储中有记录,从代码中选择它的正确方法是什么?
提前谢谢。