Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid colmodel index string containing dot
    primarykey
    data
    text
    <p>We are upgrading both jQuery and jqGrid in a project and found a possible bug in jqGrid. The versions we are working with:</p> <ul> <li>jQuery 1.4.1 upgraded to 1.7.1</li> <li>jqGrid 3.8.2 upgraded to 4.2.0 </li> </ul> <p>We are using the colmodel's index parameter both for sorting and searching/filtering. The problem we have found appears when the index string contains a dot. E.g. "Customer.Name".</p> <pre><code>$('#grid').jqGrid({ url: 'some/controller/action', datatype: 'json', colNames: ['Customer Name'], colModel: [{ name: 'CustomerName', index: 'Customer.Name' }] }); $('#grid').jqGrid('filterGrid', '#filter', { filterModel: [{ label: 'Customer Name', name: 'CustomerName', stype: 'text' }] }); </code></pre> <p>When the search is used the browser throws an exception as follows:</p> <pre><code>Syntax error, unrecognized expression: [name=Customer.Name] http://localhost:8000/Scripts/jquery-1.7.1.js Line 4179 </code></pre> <p>The exception is originating from row 465 in grid.addons.js which looks like this:</p> <pre><code>447: nm = this.index; 465: v = $("input[name="+nm+"]",self).val(); </code></pre> <p>The code is inside an each operator and gets the value from the colModel/filterModel, so <code>this</code> is each element in that array.</p> <p>After some research we found that in jQuery 1.5 the attribute selector requires quotes around the value, which the grid doesn't seem to use and thus failing when searching for the element.</p> <p>Question is: Is there any workaround for this or should we post a bug to jqGrid and hope they fix it soon?</p> <p>We have tried escaping the dot and surrounding the string with quotes, but nothing helps.</p>
    singulars
    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.
    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