I'd like the auto-select all the rows of my flexigrid. I guess I should somehow use
.addClass('trSelected')
or something like that, but to what elements ?
To call the flexigrid, I use
var gridSelector = "#createBordereauFlexigrid";
var gridOptions = {
url: '_v2_db2Request.php?req=READ-DEPOSIT-SLIP',
dataType: 'json',
colModel : [
{display: 'Id', name: 'registrationaccountid', width: 40, sortable: false, align: 'left'},
{display: 'Date', name: 'paymentdate', width: 60, sortable: false, align: 'left'} ],
buttons : [ {name: 'Tout sélectionner', onpress: selectAllFunction}} ],
title: 'Sélection des paiements',
rp: 1000,
showTableToggleBtn: false,
resizable: true,
width: 700,
height: 310,
singleSelect: false,
usepager: false,
useRp: false
}
$(gridSelector).flexigrid(gridOptions);
And usually I would use something like this the get the selected rows and ids.
function sellectAllFunction(com, grid) {
var ids = [];
$('.trSelected',grid).each(function() {
var pattId = /^row([0-9]+)$/;
var match = pattId.exec($(this).attr('id'));
ids.push(match[1]);
});
}
Thanks!
After all, I found my solution.
function selectAllFunction(com,grid) {
$( "#createBordereauFlexigrid tr" ).addClass('trSelected');
}
Pretty easy and straight forward, too bad there are no decent Flexigrid Tutorial!