0
votes

I am new with dojo and I am trying to create a datagrid with disabled checkboxes in it.

layout[0] = {name: ' ', field: 'selected', width: '20px', editable:       false, cellType: dojox.grid.cells.Bool};
var grid = new DataGrid({
    id: 'target_id',
    store: new ObjectStore({
      objectStore: myData
    }),
    query: {parent: 'root'},
    structure: layout,
    rowSelector: '0px'
  });

But instead of disabled checkboxes , the only thing I can see is "true" or "false". True if the disabled checkbox should be checked and false if not

Non-Editable-Checkboxes

And this is how it looks like if I switch editable to true

Editable checkboxes

How can I make the checkboxes visible (instead of "true" and "false", but disabled?)

1

1 Answers

0
votes

Did you try using indirect selection like http://dojotoolkit.org/documentation/tutorials/1.8/working_grid/demo/selector.php for the grid? with this, checkboxe's are always rendered on the left side of the grid.

If this is not what you are looking, then I would suggest you implement formatter so that you can display a checkbox wherever you want.

var yourLayout = [
            [
                {name:'ID', field:"id" },
                {name:'Value', field:"id", formatter:this.renderCheckBox}
            ]
        ];

renderCheckBox:function (val) {
        var checkbox = "<input type='checkbox' name='myCheckBox' value='" + val + "/>";
                    return checkbox;
    },

I found a jsfiddle link for this. Hope this helps.

http://jsfiddle.net/UUnfR/4/