Dgrid RenderCell - Disabled CheckBox
by schlomm
HTML
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/claro/claro.css">
<div dojo-data-type="dijit/layout/BorderContainer">
<div dojo-data-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
<fieldset>
<legend>Requirement</legend>
<ul>
<li>Create checkboxes that are disabled</li>
</ul>
</fieldset>
</div>
<div dojo-data-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
<div id="existingItemsGrid"></div>
</div>
</div>
CSS
.field-iceCream {
width: 30px;
}
JavaScript
var ui = {};
require({
packages: [{
name: 'dstore',
location: '//cdn.rawgit.com/SitePen/dstore/v1.0.0'
}]
}, ["dojo/ready", "dojo/dom-construct", "dstore/Memory"],
function (ready, domConstruct, Memory) {
ready(function () {
var db = [{
id: 100,
firstName: "Billy",
lastName: "Madison",
likesIceCream: true
}, {
id: 101,
firstName: "Tommy",
lastName: "Callahan",
likesIceCream: true
}];
for (var i = 0, l = 10; i < l; i++) {
db.push({
id: i,
firstName: "First Name (" + i + ")",
lastName: "Last Name(" + i + ")",
likesIceCream: (i % 3) == 0
});
}
ui.existingItemsGrid.set("collection", new Memory({
data: db
}));
});
});
//Setup dgrids
require({
packages: [{
name: 'dgrid',
location: '//cdn.rawgit.com/SitePen/dgrid/v0.4.0'
}, {
name: 'xstyle',
location: '//cdn.rawgit.com/kriszyp/xstyle/v0.2.1'
}, {
name: 'put-selector',
location: '//cdn.rawgit.com/kriszyp/put-selector/v0.3.6'
}]
}, ["dojo/_base/declare", "dojo/dom-construct", "dgrid/OnDemandGrid", "dgrid/Keyboard", "dgrid/Selection", "dgrid/extensions/ColumnResizer", "dgrid/Editor", "dgrid/extensions/DijitRegistry", "dojo/domReady!"],
function (declare, domConstruct, OnDemandGrid, Keyboard, Selection, Editor, ColumnResizer, DijitRegistry) {
//define grid and create
var Grid = declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, Editor]);
ui.existingItemsGrid = new Grid({
columns: {
firstName: "First Name",
lastName: "Last Name",
likesIceCream: {
editor: "checkbox",
label: " ",
autoSave: true,
sortable: false,
canEdit:...