how to make grid column as drop down list for all rows using jquery
colNames: ['A','B','C','D'],
colModel: [
{ name: 'A', index: 'A', width: 90 },
{ name: 'B', index: 'B', width: 100 },
{ name: 'C', index: 'C', width: 70 },
{ name: 'D', index: 'D', edittype: 'select', width: 100, editoptions: { value: { 1: 'Yes开发者_运维技巧', 2: 'No'}} }
],
My concerns here is, I am displaying A B C D values from db2... for Last Column do I need to put default drop down list for all the rows.
Looks like you are missing the editable
property in D's definition:
{
name: 'D',
index: 'D',
edittype: 'select',
width: 100,
editable: true,
editoptions: { value: { 1: 'Yes', 2: 'No' } }
}
Without the editable
property, it won't work as far as I know, but i could be wrong. For a working example and code, you can see these resources:
- A simplified version on jsfiddle
- jqGrid demos - Row Editing > Input Types
精彩评论