I have a jqGrid which gets json data from a service. I have to add radio buttons to a column when in edit mode. This has to be inline edit. I need to update records in batch.
I have created a custom element and custom value to show radio buttons on selectRow
in jqGrid.
The issue I have is that I can't get the value of the selected radio button.Instead it always returns the value of first radio button.
Code can be found link
Following is code that creates custom element
function radioelem(value, options) {
var receivedradio = '<input type="radio" name="receivednaradio" value="R"';
var breakline = '/>Received<br>';
var naradio = '<input type="radio" name="receivednaradio" value="N"';
var endnaradio = '/>NA<br>';
if (value == 'Received') {
var radiohtml = receivedradio + ' checked="checked"' + breakline + naradio + endnaradio;
return radiohtml;
}
else if (value == 'NA') {
var radiohtml = receivedradio + breakline + naradio + ' checked="checked"' + endnaradio;
return radiohtml;
}
else {
return receivedradio + breakline + naradio + endnaradio;
}
};
function radiovalue(elem, operation, value) {
if (operation === 'get') {
return $(elem).val();
} else if (operation === 'set') {
if ($(elem).is(':checked') === false) {
$(elem).filter('[value=' + value + ']').attr('checked', true);
}
}
};