2

I was able to put a dijit.form.DateTextBox and a dijit.form.ComboBox in a dojox.grid.DataGrid but not a dijit.form.Button. I have not tried with other widgets.

   new dojox.grid.DataGrid({
       store: new dojo.data.ItemFileReadStore({data: {items: [{option: 'option A', date:'10/31/2011'},{option: option B'}]}}),
       structure:[{
        field: "option",
        editable: true,
        type: dojox.grid.cells._Widget,
        widgetClass: dijit.form.ComboBox,
        widgetProps: {
          store: new dojo.data.ItemFileReadStore({data: {items: [{option: 'option A'},{position: option B'}]}}),
          searchAttr: 'option'
      },{
         field: 'date',
        editable: true,
        type: dojox.grid.cells.DateTextBox,
        widgetProps: {selector: "date"},
        formatter: function(v) {if (v) return dojo.date.locale.format(new Date(v),{selector: 'date'})}
       },{
         field: "button",
         type: dojox.grid.cells._Widget,
         editable: true,
         widgetClass: dijit.form.Button,
         widgetProps: {style: {width: "100px"},label: "dijit button?"}
       }]
    })

Salu2,

Jose Leviaguirre

jleviaguirre
  • 686
  • 6
  • 10
  • you should post your answer in the answer block, then accept it, so that the question is listed as answered – Ted Jan 25 '12 at 20:45

1 Answers1

2

It seems that since 1.4, the grid can handle dijits via formatter

{
  field: "button",
  type: dojox.grid.cells._Widget,
  editable: false,
  formatter: function(){
  return new dijit.form.Button({label:"test"})
}

Here is working sample solution: http://jsfiddle.net/jleviaguirre/u3QFj/5/

jleviaguirre
  • 686
  • 6
  • 10