Selection rows with memory
by FancyGrid Inc.
HTML
<script src="https://cdn.jsdelivr.net/npm/fancygrid/client/fancy.min.js"></script>
<div id="container"></div>
<button onclick="select1Row()">
Select 1 row
</button>
<button onclick="clearSelection()">
clearSelection
</button>
<button onclick="disableSelection()">
disable selection
</button>
<button onclick="enableSelection()">
disable selection
</button>
CSS
button {
margin-top: 10px;
}
JavaScript
var grid;
function select1Row(){
grid.selectRow(0);
}
function clearSelection(){
grid.clearSelection();
}
function disableSelection(){
grid.disableSelection();
}
function enableSelection(){
grid.enableSelection();
}
document.addEventListener("DOMContentLoaded", function() {
grid = new FancyGrid({
title: 'Selection rows with memory',
renderTo: 'container',
width: 550,
height: 500,
data: data,
paging: true,
selModel: {
type: 'rows',
memory: true
},
trackOver: true,
defaults: {
resizable: true,
sortable: true,
draggable: true
},
columns: [{
type: 'select'
},{
index: 'name',
title: 'Name'
}, {
index: 'surname',
title: 'SurName'
}, {
index: 'country',
title: 'Country'
}, {
index: 'position',
title: 'Position'
}, {
index: 'email',
title: 'Email'
}]
});
});
var data = [{
"name": "Mia",
"surname": "Moore",
"id": 1,
"country": "Netherlands",
"position": "Software Tester",
"email": "mia.moore@fancygrid.com"
}, {
"name": "David",
"surname": "Johnson",
"id": 2,
"country": "Belgium",
"position": "Frontend Developer",
"email": "david.johnson@fancygrid.com"
}, {
"name": "Isabella",
"surname": "Miller",
"id": 3,
"country": "Sweden",
"position": "Frontend Developer",
"email": "isabella.miller@fancygrid.com"
}, {
"name": "Ivan",
"surname": "West",
"id": 4,
"country": "San Marino",
"position": "iOS Developer",
"email": "ivan.west@fancygrid.com"
}, {
"name": "Christopher",
"surname": "Grant",
"id": 5,
"country": "Taiwan",
"position": "Data Science Engineer",
"email": "christopher.grant@fancygrid.com"
}, {
"name": "Addison",
"surname": "Thomson",
"id": 6,
"country": "Japan",
"position": "ASP.NET Developer",
"email": "addison.thomson@fancygrid.com"
}, {
"name": "Ethan",
"surname": "Brown",
"id": 7,
"country":...