Javascript dojo1.8:更新ComboSelect from函数的searchAttr

Javascript dojo1.8:更新ComboSelect from函数的searchAttr,javascript,dojo,Javascript,Dojo,嗨,我正在尝试从对象创建执行函数。我不确定这是不是正确的方法 我创建了选择组合框,但因为每个数据库都有不同的批处理字段,所以我创建了一个函数来选择正确的“批处理并稍后更新searchAttr,以便可以填充选择” 请告知 function whichbatch(dbA) switch (dbA) { case 'testdata1970_05': 'batch'; break; case 'testdata1970_10': 'batch_no';

嗨,我正在尝试从对象创建执行函数。我不确定这是不是正确的方法

我创建了选择组合框,但因为每个数据库都有不同的批处理字段,所以我创建了一个函数来选择正确的“批处理并稍后更新searchAttr,以便可以填充选择”

请告知

function whichbatch(dbA)
    switch (dbA)
     {
    case 'testdata1970_05': 'batch';
    break;  
    case 'testdata1970_10': 'batch_no';
    break;
    case 'testdata2060_03': 'batch';
    break;
    case 'dbProdigy':'Batch';
    break;
    case 'dbProdigy_MK6N':'Batch'
    break;
}

var selBatch = new ComboBox 
(
    {id:'ID_selBatch',
    value:'',
    placeHolder:'Select...',
    style:{width:'200px'},
    },'node_selBatch'
);

on(selTest, 'change', function(valueCard)
{
    var selectedTest = this.get('displayedValue');
    var selBatch = registry.byId('ID_selBatch');
    selBatch.searchAttr:(whichbatch(registry.byId('ID_selPCBA').    
    console.debug('Connecting to gatherbatches.php ...');
    request.post('gatherbatches.php',
    {  data:{nameDB:registry.byId('ID_selPCBA').value, nameCard : valueCard},
            handleAs: "json"}).then
    (
function(response)
{
    var memoStore2 = new Memory({data:response});
    selBatch.set('store', memoStore2);
    selBatch.set('value','');
    console.debug('List of batches per Test is completed! Good OK! ');
},

function(error)
 {
    alert("Batch's Error:"+error);
    console.debug('Problem: Listing batches per Test in select Test is BAD!');
 });
selBatch.startup();
});

您好,我刚刚意识到更好的方法是在编码为json之前重命名gatherbatches.php中的键,而不是使用函数。但我如何将所有键重命名为“batch”,而不考虑数据库?事实证明,我可以在查询数据库时添加“as”关键字!