tonytomov / jqGrid

jQuery grid plugin

Home Page:www.trirand.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checkbox columns in Cell-Edit mode

unle70 opened this issue · comments

Hi Tony,

I wonder what you can say about the following:
When creating a checkbox column, the default is that the checkbox is "disabled". This makes sense to me, as when you create a "view only" grid, this checkbox should not be "active".
Then, if you use "Inline Edit" (or "Form Edit"), the checkbox behaves reasonably. It becomes "enabled" once editing starts.

But what about "Cell Edit"?
Since the checkbox is "disabled", you cannot click it and cannot enter the "editing" state on that column.
Also, even if you change the default state to "enabled", still there's no "click" event handling when not in "editing" state.

I've created multiple workarounds to try and overcome this issue, but it doesn't feel "right" to me.
How do you see this?

Hello,

You can use beforeSelectRow event to analyze what you want. Within this event you can analyze which cell you click.

Tony

Hi Tony,

I'm not sure the "beforeSelectRow" will trigger in this case. Looks like there's no click-handler on the checkbox at all. In my case, I'm using jQuery ".on" function in "delegate" mode, and I'm attaching my own click handler to ALL future checkboxes inside grid cells. Then I'm handling this by myself.

I'm just pointing out that without customization, a column of type "checkbox" cannot be edited at all in cell-edit mode. You have to use "inline-edit" or "form-edit". Looks to me that this is a functionality problem.

Udi

try this

jqGrid({
...
cellEdit : true,
beforeSelectRow : function(id, e) {
	console.log(id, e.target);
},
colModel : [
....
	{name:'check', formatter :'checkbox', formatoptions :{disabled: false}, editable : false },

]
...
});