oria / gridx

Just another powerful Dojo grid
Other
162 stars 78 forks source link

ComboBox in a gridx cell doesn't show options #50

Open catshout opened 11 years ago

catshout commented 11 years ago

I've tried to define a gridx structure showing a ComboBox inside a cell for selecting values. The ComboBoxes are shown when activating cell editor but there's no content in it. I tried also the 'options' property inside the structure definition, same.

I've searched around for whole day but didn't find any solution or hint yet.

Find below the code snippet:

    var casparMessages = new Store({
        data: [
            {name: 'DESADV D96A Standard', id: 1},
            {name: 'INVOIC D96A Standard', id: 2},
            {name: 'ORDERS D96A Standard', id: 3}
        ]
    });

    var casparPartnerConnectionsStore = new Store({
        data: [
            {id: 1, message: 'ORDERS D96A Standard', partner: 'tegut...', testFlag: 'deaktiviert', printFlag: 'deaktiviert', archiveFlag: 'aktiviert', communicationType: 'AS2', communication: 'tegut... Produktion', active: 'aktiviert'},
            {id: 2, message: 'INVOIC D96A Standard', partner: 'tegut...', testFlag: 'deaktiviert', printFlag: 'aktiviert', archiveFlag: 'aktiviert', communicationType: 'AS2', communication: 'tegut... Produktion', active: 'aktiviert'},
            {id: 3, message: 'ORDERS D96A Standard', partner: 'Metro', testFlag: 'deaktiviert', printFlag: 'deaktiviert', archiveFlag: 'aktiviert', communicationType: 'AS2', communication: 'Metro Produktion', active: 'aktiviert'},
            {id: 4, message: 'INVOIC D96A Standard', partner: 'Metro', testFlag: 'deaktiviert', printFlag: 'aktiviert', archiveFlag: 'aktiviert', communicationType: 'AS2', communication: 'Metro Produktion', active: 'aktiviert'},
            {id: 5, message: 'ORDERS D96A Standard', partner: 'EDEKA AG', testFlag: 'deaktiviert', printFlag: 'deaktiviert', archiveFlag: 'aktiviert', communicationType: 'X.400', communication: 'EDEKA AG Produktion', active: 'aktiviert'},
            {id: 6, message: 'INVOIC D96A Standard', partner: 'EDEKA AG', testFlag: 'deaktiviert', printFlag: 'aktiviert', archiveFlag: 'aktiviert', communicationType: 'X.400', communication: 'EDEKA AG Produktion', active: 'aktiviert'},
            {id: 7, message: '', partner: '', testFlag: '', printFlag: '', archiveFlag: '', communication: '', active: 'deaktiviert'}
        ]
    });

    var casparPartnerConnectionsStructure = [
        {name:'Nachricht (Modul)', field:'message', editable:true, editor:'dijit.form.ComboBox', editorArgs:{props:'store: casparMessages, searchAttr: "name"'}},
        {name:'Partner', field:'partner', editable:true, editor:'dijit.form.ComboBox'},
        {name:'TestKZ', field:'testFlag', editable:true, editor:'dijit.form.ComboBox'},
        {name:'DruckKZ', field:'printFlag', editable:true, editor:'dijit.form.ComboBox'},
        {name:'ArchivKZ', field:'archiveFlag', editable:true, editor:'dijit.form.ComboBox'},
        {name:'Kommunikationstyp', field:'communicationType', editable:true, editor:'dijit.form.ComboBox'},
        {name:'Kommunikation', field:'communication', editable:true, editor:'dijit.form.ComboBox'},
        {name:'Aktiv', field:'active', editable:true, editor:'dijit.form.ComboBox'},
    ];

    casparPartnerConnectionsGrid = new Grid({
        id:'casparPartnerConnectionsGrid',
        cacheClass:Cache,
        store:casparPartnerConnectionsStore,
        structure:casparPartnerConnectionsStructure,
        autoHeight:true,
        modules: [
            Modules.Focus,
            Modules.RowHeader,
            Modules.SelectRow,
            Modules.CellWidget,
            Modules.Edit,
            Modules.VirtualVScroller
        ]
    }, 'casparPartnerConnections');

    casparPartnerConnectionsGrid.startup();
catshout commented 11 years ago

Did find the reason. The code above runs in a function.

You MUST NOT use

var casparMessages

but

casparMessages

as this declares a global variable instead. An error message would help to find this without tryin' around hours.