dojox.data.Grid中的小部件(dijit.form.Button)

时间:2011-10-18 14:50:32

标签: grid widget dojo

我能够在dojox.grid.DataGrid中放置dijit.form.DateTextBox和dijit.form.ComboBox,但不能放入dijit.form.Button。我没有尝试过其他小部件。

   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,

何塞Leviaguirre

1 个答案:

答案 0 :(得分:2)

似乎从1.4开始,网格可以通过格式化程序处理dijit

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

以下是工作示例解决方案:http://jsfiddle.net/jleviaguirre/u3QFj/5/