How to create a new widget for dojox.grid.cells.dijit?
Posted
by the_drow
on Stack Overflow
See other posts from Stack Overflow
or by the_drow
Published on 2010-03-25T22:51:30Z
Indexed on
2010/03/25
22:53 UTC
Read the original article
Hit count: 313
I am trying to create a button widget for dojox.grid.
My problems are:
1) The button is only shown when I double click the grid.
2) I can't figure out how to set attributes through declarative markup. It seems that the markupFactory function is responsible for it but it doesn't set the widget's label.
The following code demonstrates what I've got so far:
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dijit.form.Button");
dojo.require("dojox.grid.cells.dijit");
dojo.require("dojo.parser");
dojo.declare("dojox.grid.cells.Button", dojox.grid.cells._Widget, {
widgetClass: dijit.form.Button,
alwaysEditing: true,
constructor: function(inCell)
{
this.inherited(arguments);
this.widget = new dijit.form.Button;
},
setValue: function(inRowIndex, inValue){
if (this.widget) {
this.widget.attr('value', inValue);
}
else {
this.inherited(arguments);
}
}
});
dojox.grid.cells.Button.markupFactory = function(node, cell)
{
dojox.grid.cells._Widget.markupFactory(node, cell);
}
© Stack Overflow or respective owner