Neeraj
Neeraj

Reputation: 9155

JQGrid: making all checkboxes checked by default

After adding following in JQGrid :-

Models

{name: 'checkbox', index: 'checkbox', width:"5%", formatter: "checkbox", formatoptions: { disabled: false } },

Columns

"Select"

JQGrid has displayed column having check boxes that is correct but by default all check boxes are checked that is not expected.

I am not sure if this is the default behavior of JQGrid check box column. I don't want to display all check boxes checked by default. How to fix this?

Upvotes: 0

Views: 2994

Answers (2)

Renascent
Renascent

Reputation: 184

Same Problem:

{ name: "id", index: 'id', width: '110', hidden: true},

{ name: 'id', width: "100", index: 'id', key: true, editable: true, edittype: 'checkbox', editoptions: { value: 'Yes:No'} formatter: "checkbox", formatoptions: { disabled: false } },

I had same problem i resolved it... Here is the Solution... you must be using same name & index for two columns . Corrected Code:

{ name: "id", index: 'id', width: '110', hidden: true},

{ name: 'checkbox', width: "100", index: 'checkbox', key: true, editable: true, edittype: 'checkbox', editoptions: { value: 'Yes:No'} formatter: "checkbox", formatoptions: { disabled: false } },

Upvotes: 0

Oleg
Oleg

Reputation: 221997

Per default checkboxes are non-checked. You can use defaultValue property of formatoptions to change default value:

formatoptions: {defaultValue: "yes"}

By the way the setting of width in % (like width:"5%") is not supported by jqGrid.

Upvotes: 1

Related Questions