0

Hi (sorry for my pityful english) i have been reading on JQGrid for about 4 days. Small examples work great. But each time, the example show a grid alone filled at the loading of the page. i would like to have a search screen (one textbox like google) and show the answer in the jqGrid (on the post message). I have seen some part of code with datatype, other with jsonReader...but nothing complete. I am totally lost. i just want to fill the grid in json post and when i try, i only get the json message in text on the screen.

I am using ASP.NET MVC4, and learn with free JQGrid. I am quite sure such an example exists. I must be a poor searcher myself.

Can you give a link to such an example? thank you very much.

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
JFL
  • 1
  • 2
  • First of all it's important to mention how many rows of data you need to display in the grid **totally** (in all pages). I recommend you to use `loadonce: true` option and to return array of all items from MVC Controller. It makes code very easy and the searching/filtering, sorting and paging will be implemented *by jqGrid on the client side*. – Oleg Sep 28 '16 at 10:51
  • If you need searching in *separate columns* then [filterToolbar](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching) will be good. For *global* filtering see [here](http://stackoverflow.com/a/19728244/315935) and [here](http://stackoverflow.com/a/22717875/315935). Moreover it's important to choose between [free jqGrid](https://github.com/free-jqgrid/jqGrid) fork, which I develop, and commercial [Guriddo jqGrid JS](http://guriddo.net/?page_id=103334). – Oleg Sep 28 '16 at 10:52
  • thank you for your answer. Sorry not to have answered before. i never received an email telling me i had an answer. Have to look at that.. I use your free jqGrid. I absolutely don't want to load all record at one (more than 30000). I would prefer to put my choices in a form et get the Json back of the answer. – JFL Oct 03 '16 at 14:24
  • for now. the json answer arrives on another page and not the same page in the grid. Ihave tried the solution in adding request parameters in the url and writing : s = '@Url.Action("Recherche","PasserelleFlux")' + s jQuery("#list").jqGrid().setGridParam({ url: s}).trigger("reloadGrid"); but it does not work. – JFL Oct 03 '16 at 14:29
  • If you want to filter the data *on the server* then you need just use `postData`: see [the old answer](http://stackoverflow.com/a/2928819/315935). You need of cause implement server side paging, sorting and filtering in your server side code. – Oleg Oct 03 '16 at 14:51
  • Thank you very much. thanks to you, i have succeded in filling my grid in GET mode adding a parameter to the query string before reloading the grid and in post mode using postData like in the example [link](https://forums.asp.net/t/1814027.aspx?How+to+use+postData+of+jqGrid+). thank you very much Oleg like always :) – JFL Oct 04 '16 at 20:16
  • For beginners like me who read theses line postData is with a "D" and not a "d"....you could save a lot of time.... ;) – JFL Oct 04 '16 at 20:17
  • You are welcome! I'm glad that I could help you. By the way, JavaScript is case sensitive. Thus one have to use the exact case in all options, callbacks and so on. – Oleg Oct 04 '16 at 20:40

1 Answers1

0

If you are preloading all of the data needed for your jqGrid, then you can add a client-side search textbox using the code I've documented here:

jqGrid client-side searching

This is useful for small datasets, where (for example) you want to quickly search for a particular person in a JavaScript array of employee records, but it won't be useful if you have a very large dataset.

This example also shows how to use a search textbox without having to open jqGrid's user-unfriendly Search popup dialog.

Searching

Community
  • 1
  • 1
Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159
  • Hello. thank you for your answer. i have seen your very good answer. I keep it for solving another problem on another page. But that is not what i want to do for now. – JFL Oct 03 '16 at 14:30