Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery jqGrid trigger reloadGrid

I'm using a jqGrid to display the results of a search. When the search button is clicked it does this:

$("#Search").jqGrid('setGridParam', { url: url }).trigger("reloadGrid");

Where url contains the search params, for example:

var url ="/search?first=joe&last=smith"

The web server is receiving this URL and responding appropriately. But on the client side it throws this error in jqgrid.min.js line 21:

Syntax error:    
}); b.fn.jqGrid = function(f) { 

What can I do to fix this? I'm using jqGrid sucessfully in many other places, but this is the only one where I'm changing the URL and reloading.

like image 300
JK. Avatar asked Oct 26 '22 14:10

JK.


2 Answers

Try using the non minified version on this page to see more context of why it's surrounding. What you're seeing there is a where parsing is halting; I suspect your error is further up. This way you can see if the current url is being used and what's throwing it off.

like image 63
Dan Heberden Avatar answered Nov 09 '22 11:11

Dan Heberden


It seems to me that the error which you have in jqgrid.min.js corresponds an error in uncompressed version of jqGrid direct at the beginning of .jqGrid('setGridParam', { url: url }) (see line 82 of grid.base.js). It is the part of the so named "New API" introduced in 3.6 version of jqGrid. The code fragment started with following lines:

$.fn.jqGrid = function( pin ) {
    if (typeof pin == 'string') {
        var fn = $.fn.jqGrid[pin];
        if (!fn) {
            throw ("jqGrid - No such method: " + pin);
        }
        var args = $.makeArray(arguments).slice(1);
        return fn.apply(this,args);
    }
//...

I am not sure why you have a "syntax error", bu I recommend you to verify, that the id of the grid is really "Search". If you will don't find an error add more information in your question. For example: which version of jQuery you use? Including of a code fragment and the order of JavaScripts which you load would be also helpful.

like image 38
Oleg Avatar answered Nov 09 '22 12:11

Oleg