Home > Article > Web Front-end > How to Highlight a Row in JqGrid When a Checkbox is Checked?
How to Highlight a Row When a Checkbox is True in JqGrid
In a jqGrid, you can easily highlight a row when the checkbox is true. Here's a step-by-step guide:
gridview: true, rowattr: function (rd) { if (rd.GroupHeader === "1") { // Adjust this to match your checkbox column return {"class": "myAltRowClass"}; } }
cmTemplate: {align: 'center', sortable: false, editable: true, width: 80},
var myCheckboxTemplate = {formatter: 'checkbox', edittype: 'checkbox', type: 'select', editoptions: {value: "1:0"}};
Then, in your colModel, instead of defining complex objects for each checkbox column, simply use the template:
{name: 'GroupHeader', index: 'GroupHeader', template: myCheckboxTemplate}
By following these steps, you'll be able to highlight rows based on checkbox values in your jqGrid.
The above is the detailed content of How to Highlight a Row in JqGrid When a Checkbox is Checked?. For more information, please follow other related articles on the PHP Chinese website!