I have found the example to check/uncheck the entire column, but I am looking for a way to use a button(s) to check a checkbox cell when the checkbox value starts with a letter or set of letters (e.g. Starts with A, Starts with A45, etc). Are there any examples of buttons doing this? Below is the code I gave right now for the grid:
var colModel = [
{
title: "Activity",
minWidth: '30%',
dataIndx: "FASActivity",
type: 'checkbox',
cbId: 'chk',
hidden: false,
useLabel: false
},
{
dataIndx: 'chk',
dataType: 'bool',
cb: { header: true },
hidden: true,
editable: function (ui) {
//to make checkboxes editable selectively.
return !(ui.rowData.Activity.length > 10);
}
},
{ title: "Description", dataType: "String", dataIndx: "FASDesc", editable: false, minWidth: '30%', },
{ title: "Region", dataType: "String", dataIndx: "Region", editable: false, minWidth: '10%', },
{ title: "Country", dataType: "string", dataIndx: "Country", editable: false, minWidth: '10%', },
{ title: "Year", dataType: "String", dataIndx: "YearSplit", editable: false, minWidth: '10%', }
];
//Define Data Mode;
var dataModel = {
location: "remote", //server side call
dataType: "jsonp",
method: "GET",
url: "/CCRSearch/FAS/grid_jsonp", //URL
getData: function (dataJSON, yearval) {
var data = dataJSON.data;
return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
}
};
var pageModel = {
type: "remote", //Paging remote
rPP: 500, strRpp: "{0}", //default paging parameters
}
var grid = $("#grid_jsonp").pqGrid({
height: 550,
scrollModel: { autoFit: true },
dataModel: dataModel,
colModel: colModel,
auroRow: false,
numberCell: { show: false },
resizable: true,
filterModel: {
on: true,
header: false,
type: 'remote',
menuIcon: false,
mode: "AND"
},
pageModel: pageModel,
toolbar: {
style: 'text-align:center;',
items: [
{
type: 'button',
label: 'ATP',
listener: function () {
// check all Activities that start with 'A19'
EntityFilter('ATP');
}
},
{ type: 'separator' },
{
type: 'button',
label: 'FMD',
listener: function () {
// check all Activities that start with 'F'
EntityFilter('FMD');
}
},
{ type: 'separator' },
{
type: 'button',
label: 'MAP',
// check all Activities that start with 'M'
listener: function () {
EntityFilter('MAP');
}
},
{ type: 'separator' },
{
type: 'button',
label: 'RAPP',
// check all Activities that start with 'A24'
listener: function () {
EntityFilter('RAPP');
}
},
{ type: 'separator' },
{
type: 'button',
label: 'RAPP2',
// check all Activities that start with 'A25'
listener: function () {
EntityFilter('RAPP2');
}
}
]
},
wrap: true, hwrap: true,
virtualX: true, virtualY: true,
complete: function (event, ui) {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
}
});