I am trying to format a cell on jqGrid so that when the user edits it they are presented with a custom implementation of a combobox (called activecombo) as the select html component is ugly.
I have read this and looked at the demos but they don't seem to do quite what I want. Here's what I have tried:
var maritalStatusPickerFunction = function(cellvalue, options,
rowObject) {
var optionsArray = [ {
"id" : 1,
"status" : "Married"
}, {
"id" : 2,
"status" : "Divorced"
}, {
"id" : 3,
"status" : "Separated"
}, {
"id" : 4,
"status" : "Widowed"
}, {
"id" : 5,
"status" : "Unmarried"
}
];
var comboInput = $("<input type='text' value='" + cellvalue
+ "' />");
comboInput.activecombo( {
source : optionsArray
});
return comboInput;
};
$('#relationshipsGrid').jqGrid( {
datatype : "local",
colNames : [ 'Contact', 'Relationship' ],
colModel : [ {
name : 'contact',
index : 'contact',
width : 420
}, {
name : 'relationship',
index : 'relationship',
editable : true,
formatter : maritalStatusPickerFunction,
width : 120
} ],
width : 600,
height : 100,
cellEdit : true,
editurl : "server.php"
});
But that's obviously not what I am supposed to do as this just displays Object object in an input in a cell.
Can anyone give me any pointers?
Thanks,
Amy