November 2nd, 2014

Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Sorting/Toolbar Filtering with local datatype....
New Member
Forum Posts: 2
Member Since:
sp_UserOfflineSmall Offline

I've seen a few posts on this but none of these solutions seem to work.  I am attempting to setup a jqGrid to work with a webmethod...this works fine, and it's very simple as I'm using a "loadonce" setup.  So the data comes in and loads into the grid fine, but with this setup I can't perform any column sorting (does nothing) or toolbar filtering (always returns 0 rows).  I have done all the usual things....setting the datatype to local, setting loadonce to true, etc....but nothing seems to work. I have the data being loaded separately via an ajax call, then manually setting the grid's 'data' attribute with the returned data, as this was recommended on another forum post for cases where the grid needs to be loaded dynamically (not on page load) and the query is parameterized. 

I'll only post the client-side code since the issue is there, the server code is a standard JSON-serialized array (this data comes back correctly)...

The "onload" event for the page (initial setup of grid properties, but no data loaded)...

$(document).ready(function () {
    var mygrid = jQuery("#s3list").jqGrid({
        datatype: 'local',
        mtype: 'POST',
        height: 206,
        width: 400,
        colNames:['Name', 'Mnemonic'],
            { name:'Name',index:'name', width:150, sorttype:'text' },
            { name:'Mnemonic',index:'mnemonic', width:250, sorttype:'text' },
        loadonce: true,
        sortname: 'name',
        hidegrid: false,
        viewrecords: true,
        rownumbers: false,
        sortorder: "desc",
        gridview : true,
        caption:'Feature RVS:&nbsp;<select id="prrvs" onchange="GetFeatures();" style="width:300px;"></select>',
        emptyrecords: "Select a RVS for features...",
        ondblClickRow: function(id)    {
            alert('double-clicked: ' + id);
    jQuery("#s3list").jqGrid('filterToolbar', { searchOnEnter: true, defaultSearch: 'cn' });


The event (drop down list change) that fires the AJAX request and sets the 'data' in the grid then triggers a reload (this works for populating the grid, but the sorting/searching is broken)...

function GetFeatures()
    var rvsid = $('#prrvs').val();
        type: 'POST',
        url: 'AEEditor.aspx/GetRVSProductRequirements',
        data: "{'guidRVSGroupID' : '" + rvsid + "'}",
        contentType: 'application/json; charset=utf-8;',
        dataType: 'json',
        success: function (msg)
            var prdata = msg.d;

            if (prdata.length > 0)
                $('#s3list').jqGrid('setGridParam', { data:prdata }).trigger('reloadGrid');
                // Clear grid data if empty set is returned...for some reason this doesn't clear grid...
                $('#s3list').jqGrid('clearGridData', true);
        error: function (jqXHR, textStatus, errorThrown) {
            alert('Query error: ' + errorThrown);

Is there something I'm missing here?  During some testing, I verified (after the grid is loaded) that the datatype is indeed set to 'local' and the loadonce is set to true.  Is there something else I need to do?  Thanks!

New Member
Forum Posts: 2
Member Since:
sp_UserOfflineSmall Offline

Ok, as it turns out...for local/loadonce data....the "index" property of each sortable/searchable column (in the colModel) must be *exactly* (case sensitive) the same as the "name" property.  Matching the case of these two properties in both of my columns fixed both the sorting and searching issues.

Sofia, Bulgaria

Forum Posts: 7721
Member Since:
sp_UserOfflineSmall Offline


Glad to hear you solved the problem.


For professional UI suites for Java Script and PHP visit us at our commercial products site - - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

Currently Online:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam,

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information