0

I am missing something very basic, my comboxbox never appears, can somebody please look at the following code and tell me what I am missing, I have tried both .Select and ComboBox as type and I ma using dojo-1.5

var layout4 = 
[
{ field: "abbr", name: "Abbreviation", width: 10 },
{ field: "name", name: "Name", width: 10 },
{ field: "capital", name: "Capital", width: '10'},
{ field: "combo", name: "combo", width: 10,
  type: dojox.grid.cells.Select, 
  options: [ "new", "read", "replied" ],
  editable:true
}

];

var store4 =   { identifier: 'abbr',
 label: 'name',
 items: [
{ abbr:'ec', name:'Ecuador',           capital:'Quito', combo:'' },
{ abbr:'eg', name:'Egypt',             capital:'Cairo', combo:''},
{ abbr:'sv', name:'El Salvador',       capital:'San Salvador', combo:''},
{ abbr:'gq', name:'Equatorial Guinea', capital:'Malabo', combo:''},
{ abbr:'er', name:'Eritrea',           capital:'Asmara', combo:'' },
{ abbr:'ee', name:'Estonia',           capital:'Tallinn', combo:''},
{ abbr:'et', name:'Ethiopia',          capital:'Addis Ababa', combo:'' }
  ]};

storeData =  new dojo.data.ItemFileReadStore(
            { data:store4}
        ); 
    // create a new grid:
    var grid4 = new dojox.grid.DataGrid({
        query: { abbr: '*' },
        store: storeData,
        clientSort: true,
        rowSelector: '20px',
        structure: layout4
    }, document.createElement('div'));

    // append the new grid to the div "gridContainer4":
    dojo.byId("gridContainer4").appendChild(grid4.domNode);

    // Call startup, in order to render the grid:
    grid4.startup();

2 Answers 2

0

Try replacing the long line that you have using appendChild() with this one:

grid4.placeAt("gridContainer4");

Your code is rather scrambled and without seeing the whole thing it's a little hard to debug. Do you get any errors on the console? Can you post a complete example on JSFiddle?

1
  • jsfiddle.net/nRMrA/17 It is my first use of jsfiddle, I pasted there, nothing is showinf but you can look at code! Please note that grid is showing properly when I run it in browser, it is just the combobox part that is not working!
    – zaini
    Dec 28, 2011 at 12:32
0

The reason was that I was using ItemFileReadStore, and it was not allowed to edit an item in store and so combobox was not appearing. Using WriteStore solves this problem here. Ofcourse it was dumb to use readsotre.

Now I have a different problem where I want combobox to appear in grid where canEdit is implemented, but that is a different question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.