JqGrid: an editable column that always shows a selection

Is there a way in jqgrid to have an editable column that uses select, as in this example colModel:

{ 
name: 'Options', 
index: 'Options', 
width: 150, 
align: 'left', 
resizable: false,
editable: true, 
edittype: 'select', 
editoptions: { 
    value: function() { return buildSelect(); } 
},
formatter: 'select'
}

but always shows a choice?

I have this work with checkboxes, but there seems to be no way to do this with select. Ideally, I would like this to work in celledit mode. Any ideas?

+2
source share
1 answer

Everything is possible. I'm not sure what you want, this is the best way. In most cases, I recommend using some standard method, then your live will be easier, especially after changing the new version of the control you are using.

(. http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter) formatter: 'select', , . ,

{ name: 'Options', width: 150, align: 'left', editable: true, edittype: 'select',
  editoptions: { 
    value: function() { return buildSelect(); } 
  },
  formatter: function (cellvalue, options, rowObject, action) {
    if (cellvalue === 'Yes') {
      return '<select><option value="1" selected="selected">Yes</option>' +
                     '<option value="0">No</option></select>';
    } else {
      return '<select><option value="1">Yes</option>' +
                    '<option value="0" selected="selected">No</option></select>';
    }
  }
}

select "" "" ( "" "" ). change select.

+4

All Articles