tags:

views:

288

answers:

1

Here's a simple question. I have a jqGrid that's working great but I want set the default value for a checkbox to checked when user adds a new item. Here's a snippet of code:

{name: "Active", index: "active", width: 80, align: "center", sortable: false,
 editable: true, edittype: "checkbox", editoptions: {value: "Yes:No"}}

I don't see anything in the documentation:

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules

A: 

You can use

editoptions: {value: "Yes:No", defaultValue: "Yes"}

(see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#editoptions).

By the way, I you formatter: 'checkbox' always for columns like you have. Moreover

stype: "select", searchoptions: { value: "1:Yes;0:No" }

can be also helpful if you allow to search for values fron the column.

Oleg
Prefect solution and thanks for the suggestion.
gurun8