I am using Selector and Selection Mixin in Dgrid ondemandgrid.I am using checkbox as a selector.Below are my questions.
- How to get the List of Checked rows in a javascript on a html button click?I know there is a dgrid-select and deselect events,but i want the list of all the selected rows on a button click event.
- Currently , if i click on a row at any position ,the checkbox is getting selected.But I want to select the row only when i click on the checkbox.How to achieve this?
Here is my code
require([
"dgrid/OnDemandGrid",
"dojo/store/JsonRest",
"dojo/dom",
"dojo/dom-style",
"dojo/_base/declare",
"dgrid/extensions/ColumnResizer",
"dgrid/Selection",
"dgrid/selector"
], function (OnDemandGrid,JsonRest,dom,domStyle,declare,ColumnResizer,Selection, selector) {
var Layout = [
selector({ label: selector({}), selectorType: "checkbox" }),
{field: 'srno',label: 'Sr No'},
{field: "Name",label: "name"}
];
jsonstore = new JsonRest({target: url,idProperty: "srno"});
grid = new(declare([OnDemandGrid,ColumnResizer,Selection]))({
store: jsonstore,
columns: Layout,
minRowsPerPage : 40,
maxRowsPerPage : 40,
keepScrollPosition : true,
allowSelectAll: true,
loadingMessage: "Loading data...",
noDataMessage: "No results found."
}, "grid");
domStyle.set(dom.byId("grid"),"height","210px");
grid.startup();
grid.on("dgrid-select", function(event){
//
});
grid.on("dgrid-deselect", function(event){
//
});
});