0

I try to call one page with jqGrid (windows.location.href='localhost/jqgrid?_search=true') enabling search setting the parameter _search true, but it doesn't work as jqGrid append the search parameter by itself. http://catalog.localhost/de/jqgrid/index/c_edition?_search=true&rows=10&page=1&searchField=work_id&searchOper=eq&searchString=3&_search=false&nd=1296026941396&rows=20&page=1&sidx=&sord=asc How can we solve this problem?

Thanks

Anatoliy
  • 321
  • 1
  • 4
  • 19

1 Answers1

1

The usage of windows.location.href to set url having ?_search=true seems me the wrong way. jqGrid can get per AJAX request data from the server. So you should set url parameter of the jqGrid on the new page and not set windows.location.href to the url.

Moreover the usage of _search=true parameter to start searching is also the wrong way. See links from this answer for more information.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • You mean that setting of the search parameters is possible only by using of grid.jqGrid('setGridParam', { search: true, postData: newPostData }); and not by passing GET-parameters? The idea of using windows.location.href is to link one page with jqgrid to another one with jqgrid with complete page load passing some parameters, and not DOM-load. – Anatoliy Jan 26 '11 at 09:04
  • @Anatoliy: What I mean is that you have to provide **two** different server urls: *one* which produce pure JSON or XML data to fill the grid contain (this url should support `_search` and other jqGrid parameters) and *another* which use set per `windows.location.href`. The last url get HTML/XHTML and JavaScript which define jqGrid. To tell the truth I personally prefer to use Master/Detail scenario where setting of `windows.location.href` is not needed and the second (detail) grid will be displayed on the same page below the master grid. – Oleg Jan 26 '11 at 10:20
  • You are right, it is exactly scenario I have. But: as you might see above (in my question), the jqGrid appends `_search` parameters by itself and my setting is overwritten. Can I disable this automatic appending? Ad. `windows.location.href` vs Master/Detail - at the moment I prefer clear distinction as it seems to be easier for user to capture data from only one grid. Furthermore, what is with smaller displays with res 1024x867? – Anatoliy Jan 27 '11 at 00:38
  • @Anatoliy: My main problem to understand you is following: it you set `windows.location.href` to an URL it means the url to HTML page. The `url` parameter of jqGrid response with JSON or XML data. So I don't understand why you use `?_search=true` for the HTML page? So I don't understand how you organize your server code. Nevertheless if you want that jqGrid **not append _search parameter** to the url you can use additional parameter `prmNames: { search: null }` of jqGrid. – Oleg Jan 28 '11 at 12:35
  • Yes, with href I set the url to HTML page. Imagine, i have a grid works and artists. From each grid I will make a link to works of the given artist, or from works to the artist. I dont want to use subgrid, as I have deep relations, and it would be like grid->subgrid->subsubgrid and so on. I use the parameter ?_search to pass it through to ajax controller, and thus limiting the output of data. Is the concept below now much clearer? – Anatoliy Jan 28 '11 at 23:37