无法在dojotoolkit中的datagrid中插入组合框

时间:2013-09-05 05:26:28

标签: javascript datagrid dojo dojox.grid.datagrid dojox.grid

require(['dojo / _base / lang','dojox / grid / DataGrid','dojo / data / ItemFileWriteStore','dojo / dom','dojo / domReady!'],     function(lang,DataGrid,ItemFileWriteStore,dom){
    var data = {       标识符:“id”,       项目:[]     };     var data_list = [       {col1:“normal”,col2:'X',col3:'A',col4:29.91,col5:1,combo:'combo'},       {col1:“important”,col2:'Y',col3:'B',col4:9.33,col5:2,combo:'combo'},       {col1:“important”,col2:'Z',col3:'C',col4:19.34,col5:1,combo:'combo'}

];
var rows = 10;
for(var i = 0, l = data_list.length; i < rows; i++){
    data.items.push(lang.mixin({ id: i+1 }, data_list[i%l]));
}
var store = new ItemFileWriteStore({data: data});
var layout = [[
  {'name': 'SNO', 'field': 'id', 'width': '100px'},
  {'name': 'Name', 'field': 'col2', 'width': '100px'},
  {'name': 'Batch ', 'field': 'col3', 'width': '200px'},
  {'name': 'Percent', 'field': 'col4', 'width': '150px'},
  {'name': 'stage', 'field': 'col5', 'width': '150px'}
  {'name':'combo','field':'combo','width':'200px',
      'require':'js.dojox.grid.cell.dijit.js','cellType':'js.dojox.grid.cells.ComboBox','options':[ 'A', 'B', 'C' ],'editable':'true'}
]];
var grid = new DataGrid({
    id: 'grid',
    store: store,
    structure: layout,
    rowSelector: '20px'});
    grid.placeAt("gridDiv");
    grid.startup();

});

1 个答案:

答案 0 :(得分:0)

你必须添加

dojox/grid/cells/dijit

到你的要求