I have a checkboxes on my grid by ways of having the following code:
colNames: [..., 'Select'],
...
...
{ name: 'act', index: 'act', width: 30, sortable: false }
....
<input type="button" id="bUpload" value="Upload Report" />
What the user clicks on the Upload button, and the user has multiple checkboxes selected for this column, I like to show a message. I am not sure how to do this.
I tried the following but
$("#bUpload").click(function() {
var selectedRow;
if ($("input:checked").length > 1)
{
alert('Error - Please select only one row.');
return false;
}
if ($("input:checked").length > 0)
{
$("input:checked").each(function()
{
selectedRow = this.value ;
});
}
....
This works but the reason why I do not like this is because I can have other checkboxes for other columns as well to where there can be confusion as to if they selected from the 'act' column or not. How do I say if the column is for 'act' then check how many were selected.
id
attribute. At the first look the usage offormatter: "checkbox", formatoptions: {disabled: false}
would be the best choice for you. You can use additionallybeforeSelectRow
oronCellSelect
to catch checking of the checkboxes. – Exhortative