Note that there are some explanatory texts on larger screens.

plurals
  1. POJQGrid Edittype: 'select' using dataurl returns <select> with <optgroup> not saving select value
    primarykey
    data
    text
    <p>I have a JQGrid column with edittype:'Select' using dataUrl to return a list of Accounts with groups for the different Account groups. </p> <p>My issue: when saving the row no value is passed to the editurl for my Select column. If i remove the 's a value is passed to editurl for my Select column.</p> <p>Description: For my column data I return the Account Name, not the value, so when the grid loads the name is displayed.</p> <p>When a line is edited (in-line editing), the dataUrl is called and the select list is displayed and my Account is selected for the rows data.</p> <p>I then select a new Account from the Select list and press enter to save. The selected Account value is not passed to the editurl function for the column. if i remove the 's from the the Account value is passed to the editurl function.</p> <p>I'm not sure if I'm doing something wrong, ie not setting a grid parameter,</p> <p>Hoping you can help me out.</p> <p>Thanks in advance,</p> <p>Chris</p> <p>My Grid code:</p> <pre><code>$(document).ready( function () { var lastSelection; var grid = jQuery("#BankTransactions"); grid.jqGrid({ url: '/DropDown/GridData/', datatype: 'json', mtype: 'GET', colNames: ['TransactionLineId', 'TransactionId', 'BankTransactionId', 'Number', 'Amount', 'Category'], colModel: [ { name: 'transactionLineId', index: 'transactionLineId', editable: true, editrules: { edithidden: true }, hidden: true, width: 40, align: 'left' }, { name: 'transactionId', index: 'transactionId', editable: true, editrules: { edithidden: true }, hidden: true, width: 40, align: 'left' }, { name: 'bankTransactionId', index: 'bankTransactionId', editable: true, editrules: { edithidden: true }, hidden: true, width: 40, align: 'left' }, { name: 'Number', index: 'Number', width: 100, align: 'left', sortable: false }, { name: 'Amount', index: 'SubAmount', editable: true, width: 100, align: 'right', sortable: false, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'class="BankTranEdit"' }, formatter: 'currency', formatoptions: { decimalSeparator: '.', thousandsSeparator: ',', decimalPlaces: 2, defaultValue: '&amp;nbsp;'} }, { name: 'CategoryIdURL', index: 'CategoryIdURL', editable: true, edittype: 'select', //formatter: 'select', editoptions: { dataUrl: "/DropDown/CategorySelectList" }, width: 220, align: 'left' }, ], pager: jQuery('#pager'), rowNum: 100, rowList: [25, 50, 100], editurl: "/Dropdown/GridSave", sortname: 'Number', sortorder: "desc", viewrecords: true, width: 1250, height: 450, onCellSelect: function (rowid, iCol, cellContent, e) { grid.restoreRow(lastSelection); grid.editRow(rowid, true, null, null, null, null, null); lastSelection = rowid; } }); }); </code></pre> <p>Output of /Dropdown/GridData:</p> <pre><code>{"total":1, "page":1, "records":6, "rows":[ {"id":165,"cell":["165","249","125","DM000249","1500.00","Sales"]}, {"id":145,"cell":["145","229","105","SM000229","100.00","Rent"]}, {"id":153,"cell":["153","237","113","SM000237","38.07","Bank Fees"]}, {"id":185,"cell":["185","269","145","SM000269","750.00","Cash Discounts"]}, {"id":194,"cell":["194","278","154","SM000278","13.29","Rent"]}, {"id":211,"cell":["211","295","171","SM000295","100.00","Rent"]}] } </code></pre> <p>Output of /Dropdown/CategorySelectList</p> <pre><code>&lt;select&gt; &lt;optgroup label='Expenses'&gt; &lt;option value='42'&gt;Accounting Fees&lt;/option&gt; &lt;option value='60'&gt;Bank Fees&lt;/option&gt; &lt;option value='23'&gt;Bank Service Charges&lt;/option&gt; &lt;option value='24'&gt;Books and Publications&lt;/option&gt; &lt;option value='25'&gt;Cash Discounts&lt;/option&gt; &lt;option value='43'&gt;Rent&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label='Income'&gt; &lt;option value='19'&gt;Sales&lt;/option&gt; &lt;option value='20'&gt;Services&lt;/option&gt; &lt;option value='21'&gt;Interest Income&lt;/option&gt; &lt;option value='22'&gt;Other Income&lt;/option&gt; &lt;/optgroup&gt; &lt;/select&gt; </code></pre>
    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