Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid custom edittype (radio button column) custom element not firing set event on edit
    primarykey
    data
    text
    <p>I have a jqGrid which needs to have radio buttons in a column of a row while editing. Following is my code:</p> <pre><code>function BindPreclosingDocs(response) { var previouslyselectedRow; var preclosingtable = $('#preclosing'); preclosingtable.jqGrid({ datatype: 'jsonstring', datastr: JSON.stringify(response.ServiceModel), colNames: ['', 'Documents Received', 'Comments', 'SubDocument', 'NA'], colModel: [ { name: 'Documents', index: 'Documents', align: 'left', sortable: false, editable: false, width: 240 }, { name: 'DocsReceived', index: 'DocsReceived', align: 'center', sortable: false, editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", width: 140 }, { name: 'Comments', index: 'Comments', align: 'center', sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "3", cols: "16" }, width: 180 }, { name: 'SubDocument', index: 'SubDocument', editable: false, width: 1 }, { name: 'NA', index: 'NA', editable: true, formatter: 'dynamicText', width: 150, edittype: 'custom', editoptions: { custom_element: radioelem, custom_value: radiovalue} } ], rowNum: response.ServiceModel.PreClosing.length, pager: '#preclosingpagerdiv', viewrecords: true, sortorder: "asc", sortname: 'Documents', jsonReader: { root: "PreClosing", repeatitems: false, id: 'ConfigId' }, shrinkToFit: false, height: 'auto', grouping: true, groupingView: { groupField: ['SubDocument'], groupColumnShow: [false], plusicon: 'ui-icon-circle-triangle-s', minusicon: 'ui-icon-circle-triangle-n' }, loadComplete: function () { HideGroupHeaders(this); }, onSelectRow: function (id) { preclosingtable.jqGrid('saveRow', previouslyselectedRow, false, 'clientArray'); previouslyselectedRow = SetJQGridRowEdit(id, previouslyselectedRow, preclosingtable); } }); preclosingtable.setGridWidth('710'); }; //RowSelect function SetJQGridRowEdit(id, previousid, grid) { if (id &amp;&amp; id !== previousid) { grid.jqGrid('restoreRow', previousid); grid.jqGrid('editRow', id, true); previousid = id; return previousid; } }; //Build radio button function radioelem(value, options) { var receivedradio = '&lt;input type="radio" name="receivednaradio" value="R"'; var breakline = '/&gt;Received&lt;br&gt;'; var naradio = '&lt;input type="radio" name="receivednaradio" value="N"'; var endnaradio = '/&gt;NA&lt;br&gt;'; 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); } } }; </code></pre> <p>my formatter and unformatter code is as follows</p> <pre><code>dynamicText: function (cellvalue, options, rowObject) { if (cellvalue == 'R') { return 'Received'; } else if (cellvalue == 'N') { return 'NA'; } else { return ''; } } $.extend($.fn.fmatter.dynamicText, { unformat: function (cellValue, options, elem) { debugger; var text = $(elem).text(); return text === '&amp;nbsp;' ? '' : text; } }); </code></pre> <p>Issue I am having is, when I select a row and check an edit button it doesn't fire set in radiovalue function. It fires get in radiovalue function while creating radio button when a row is selected. Any help so that I can set a value to the radio button?!</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload