dojo1.8:从函数更新ComboSelect的searchAttr

时间:2013-04-23 07:01:09

标签: javascript dojo

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

我创建了select-combo框但是因为每个数据库都有不同的批处理字段,所以我创建了一个函数来选择正确的'批处理并稍后更新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();
});

0 个答案:

没有答案