dojox.grid.datagrid - Dojo - How can I add checkbox as a column in my DataGrid -
im newbie in dojo. have datagrid(which copy paste in tutortial), need checkbox column in datagrid. how can achieve that? in advance help.
below full html code:
<!doctype html> <html > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="x-ua-compatible" content="ie=emulateie7" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dijit/themes/claro/claro.css"> @import "js/dojo/dojox/grid/resources/clarogrid.css";
/*grid needs explicit height default*/ #griddiv { left: 500px; width: 600px; height: 20em; margin-left: 200px; margin-top: 100px; padding: 10px 10px 10px 10px; border:3px solid black; } #progbuttonnode { position: relative; } </style> <script>dojoconfig = {async: true, parseonload: false}</script> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.js"> </script> <script src="js/requireddojo.js" type="text/javascript"></script> <script> var grid; require(['dojo/_base/lang', 'dojox/grid/datagrid', 'dojo/data/itemfilewritestore', 'dojo/dom', 'dojo/domready!'], function(lang, datagrid, itemfilewritestore, dom){ /*set data store*/ var data = { identifier: "id", items: [] }; var data_list = [ { col1: "normal", col2: false, col3: 'but not followed 2 hexadecimal', col4: 29.91}, { col1: "important", col2: false, col3: 'because % sign indicates', col4: 9.33}, { col1: "important", col2: false, col3: 'signs can selectively', col4: 19.34} ]; var rows = 60; for(var = 0, l = data_list.length; < rows; i++){ data.items.push(lang.mixin({ id: i+1 }, data_list[i%l])); } var store = new itemfilewritestore({data: data}); /*set layout*/ var layout = [[ {'name': 'name', 'field': 'id', 'width': '150px'}, {'name': 'desc', 'field': 'col2', 'width': '150px'}, {'name': 'code', 'field': 'col3', 'width': '150px'}, {'name': 'is enable', 'field': 'col4', 'width': '150px'} ]]; /*create new grid*/ grid = new dojox.grid.datagrid({ id: 'grid', store: store, structure: layout, rowselector: '20px'}); /*append new grid div*/ grid.placeat("griddiv"); /*call startup() render grid*/ grid.startup(); }); </script> </head> <body class="claro"> <div id="griddiv"></div> </body> </html>
try
{ 'name': 'name', 'field': 'id', 'width': '150px', type: dojox.grid.cells.bool, editable: true } you can find more details @
http://dojotoolkit.org/reference-guide/1.9/dojox/grid/datagrid.html#editing-cells
Comments
Post a Comment