admin管理员组文章数量:1023764
I am trying to set the default value of a checkbox when the user hits the inlineNav "Add" button.
It would seem this question would contain the answer I desire
jqGrid add item checkbox field defaulted to checked
but alas, it doesn't work. I am using the following entry in my colModel:
{name:'enabled', index:'`enabled`', width:120,editable:true, edittype:"checkbox", editoptions:{value:"1:0", defaultValue:"1"}, formatter:"checkbox", align:"center"}
I have tried {defaultValue:1}, {value:"Yes:No", defaultValue"Yes"}, {defaultValue:function(){return:"1"}}
etc. but all don't seem to do the trick.
Can someone please help me? Am I missing something obvious, before I go rooting around in the source to help figure it out.
I am trying to set the default value of a checkbox when the user hits the inlineNav "Add" button.
It would seem this question would contain the answer I desire
jqGrid add item checkbox field defaulted to checked
but alas, it doesn't work. I am using the following entry in my colModel:
{name:'enabled', index:'`enabled`', width:120,editable:true, edittype:"checkbox", editoptions:{value:"1:0", defaultValue:"1"}, formatter:"checkbox", align:"center"}
I have tried {defaultValue:1}, {value:"Yes:No", defaultValue"Yes"}, {defaultValue:function(){return:"1"}}
etc. but all don't seem to do the trick.
Can someone please help me? Am I missing something obvious, before I go rooting around in the source to help figure it out.
Share Improve this question edited May 23, 2017 at 12:27 CommunityBot 11 silver badge asked Feb 22, 2012 at 17:25 adamadam 22.6k21 gold badges91 silver badges120 bronze badges1 Answer
Reset to default 4I suppose that you use not the last version of jqGrid. The problem with the usage of defaultValue
property of editoptions
exist in the version 4.3.0, but it's fixed in the version 4.3.1.
I make minimal modifications in the demo from my answer on your old question. Compare the demo which uses jqGrid 4.3.1 with the same demo which uses old version (4.3.0) of jqGrid. If you click on "Add" button on the new demo the checkbox will be added checked which corresponds the setting
editoptions: {value: 'Yes:No', defaultValue: 'Yes'}
On the other side the demo which uses jqGrid 4.3.0 ignore the setting and create always unchecked checkbox.
I am trying to set the default value of a checkbox when the user hits the inlineNav "Add" button.
It would seem this question would contain the answer I desire
jqGrid add item checkbox field defaulted to checked
but alas, it doesn't work. I am using the following entry in my colModel:
{name:'enabled', index:'`enabled`', width:120,editable:true, edittype:"checkbox", editoptions:{value:"1:0", defaultValue:"1"}, formatter:"checkbox", align:"center"}
I have tried {defaultValue:1}, {value:"Yes:No", defaultValue"Yes"}, {defaultValue:function(){return:"1"}}
etc. but all don't seem to do the trick.
Can someone please help me? Am I missing something obvious, before I go rooting around in the source to help figure it out.
I am trying to set the default value of a checkbox when the user hits the inlineNav "Add" button.
It would seem this question would contain the answer I desire
jqGrid add item checkbox field defaulted to checked
but alas, it doesn't work. I am using the following entry in my colModel:
{name:'enabled', index:'`enabled`', width:120,editable:true, edittype:"checkbox", editoptions:{value:"1:0", defaultValue:"1"}, formatter:"checkbox", align:"center"}
I have tried {defaultValue:1}, {value:"Yes:No", defaultValue"Yes"}, {defaultValue:function(){return:"1"}}
etc. but all don't seem to do the trick.
Can someone please help me? Am I missing something obvious, before I go rooting around in the source to help figure it out.
Share Improve this question edited May 23, 2017 at 12:27 CommunityBot 11 silver badge asked Feb 22, 2012 at 17:25 adamadam 22.6k21 gold badges91 silver badges120 bronze badges1 Answer
Reset to default 4I suppose that you use not the last version of jqGrid. The problem with the usage of defaultValue
property of editoptions
exist in the version 4.3.0, but it's fixed in the version 4.3.1.
I make minimal modifications in the demo from my answer on your old question. Compare the demo which uses jqGrid 4.3.1 with the same demo which uses old version (4.3.0) of jqGrid. If you click on "Add" button on the new demo the checkbox will be added checked which corresponds the setting
editoptions: {value: 'Yes:No', defaultValue: 'Yes'}
On the other side the demo which uses jqGrid 4.3.0 ignore the setting and create always unchecked checkbox.
本文标签: javascriptjqgrid checkboxSet default value on add newStack Overflow
版权声明:本文标题:javascript - jqgrid checkbox - Set default value on add new - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745517840a2154160.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论