Wijmo 5 | Select Multiple Rows using checkbox
Select rows without using boolean property from itemsSource
HTML
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<div id= "theGrid"></div>
<button id="getCheckedRows">
Toggle
</button>
<div id="rows">
Toggle row 2's selection:
</div>
CSS
#theGrid{
max-height:500px;
}
JavaScript
onload=function(){
//create random data
var getData = function (value) {
var countries = 'India,Japan,UK,US,China'.split(','),
data = [];
for (var i = 0; i < value; i++) {
data.push({
id: i + 1,
country: countries[i % countries.length],
sales: Math.random() * 10000,
downloads: Math.random() * 200,
});
}
return data;
};
var cvData=new wijmo.collections.CollectionView(getData(5));
var grid= new wijmo.grid.FlexGrid("#theGrid",{
itemsSource:cvData,
selectionMode: "ListBox"
});
// toggle row 2's selection
document.getElementById("getCheckedRows").onclick=()=>{
grid.rows[2].isSelected=grid.rows[2].isSelected?false:true;
}
}