Skip to content

Commit

Permalink
selector test: add test for resetting columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth G. Franqueiro committed Mar 5, 2013
1 parent 22254cf commit 9a37a0c
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions test/selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<script src="../../dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
var getColumns;

require(["dojo/on", "dgrid/OnDemandGrid", "dgrid/selector", "dgrid/Selection", "dgrid/Keyboard", "dgrid/ColumnSet",
"dojo/_base/declare", "dojo/_base/array", "dojo/json", "dgrid/test/data/base", "dojo/domReady!"],
function(on, Grid, selector, Selection, Keyboard, ColumnSet, declare, arrayUtil, json, testStore){
Expand All @@ -41,18 +43,22 @@
console.log("selection: ", json.stringify(event.grid.selection, null, " "));
}
);


getColumns = function(){
return {
col1: selector({ disabled: function(object){ return object.col1 == "note"; }}),
id: "ID",
col2: { label: 'Column 2', sortable: false },
col3: { label: 'Column 3' }
};
};

var SelectionGrid = declare([Grid, Selection, Keyboard]);

window.grid = new SelectionGrid({
store: testStore,
selectionMode: "none",
columns: {
col1: selector({ disabled: function(object){ return object.col1 == "note"; }}),
id: "ID",
col2: {label: 'Column 2', sortable: false},
col3: {label: 'Column 3'}
},
columns: getColumns(),
allowSelectAll: true
}, "grid");
window.grid2 = new SelectionGrid({
Expand Down Expand Up @@ -112,6 +118,11 @@ <h2>A grid with checkbox selectors, with select-all enabled
Set selection mode to "extended"</button>
</div>
<div id="grid"></div>
<div>
<button type="button" onclick="grid.set('columns', getColumns());">
Reset columns (should not cause errors)
</button>
</div>
<h2>A grid with radio selectors</h2>
<div>
<button type="button" onclick="gridRadio.set('selectionMode', 'none');">
Expand Down

0 comments on commit 9a37a0c

Please sign in to comment.