代码在 chrome 中工作,但在 extjs 的火狐中不起作用



我正在尝试在extjs中为组合框设置值,这在chrome中起作用,但在Firefox中不起作用。我使用了以下代码:

 function callFromController(comboitemid,itemvalue) {
        Ext.ComponentQuery.query(comboitemid)[0].setValue(itemvalue);
 };
作为

一般指南,我会使用:

function callFromController(comboitemid,itemvalue) {
    // make sure you add a # to your Id string or use Ext.getCmp insted.
    var foundComponents = comboitemid && Ext.ComponentQuery.query(comboitemid);
    if (foundComponents.length) {
        // I would add to see in your console.log('foundComponents[0]=%o',foundComponents[0])
        // to check the value of the found component
        foundComponents[0].setValue(itemvalue);
    }
};

最新更新