2011-10-18 58 views
2

我能夠在dojox.grid.DataGrid中放置dijit.form.DateTextBox和dijit.form.ComboBox,但不能放入dijit.form.Button 。我還沒有嘗試過其他小工具。dojox.data.Grid中的小部件(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

+0

你應該在答案塊中發佈你的答案,然後接受它,這樣問題就是列表編輯回答 – Ted

回答

2

看來,自從1.4,網格可以通過格式化處理的dijits

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

這裏工作樣品溶液:http://jsfiddle.net/jleviaguirre/u3QFj/5/

相關問題