views:

336

answers:

1

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);
}
+1  A: 

For 1) The button is only shown when I double click the grid.

Set singleClickEdit: true in the Grid parameters

this.grid = new dojox.grid.DataGrid({
    singleClickEdit: true,
    structure: view1,
}, tmp);
CNelson
Could I do it specifically for the button widget?
the_drow