1

I was wondering if there is a way for jqgrid to pass a certain value/string from a given view to the controller, I have a case where I would like to filter my records at the first load and then allow search. I tried to pass the value in the griddata function alongside the sid and sord ... but it would just pass that string as null, I found a couple of related posts but I couldnt utilize them.

Thanks in advance!

skaffman
  • 398,947
  • 96
  • 818
  • 769
Sue
  • 445
  • 1
  • 11
  • 25

1 Answers1

1

In general you should just set filters property of the postData jqGrid parameter and set one more parameter search:true. Look at the answer with the demo. One more answer shows how to construct the filters property.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks Oleg for your guidance, the case that I have is a hidden field in the page that contains the value which will be filtered in one of my columns, so every page will have its own hidden field value and I will have to transfer that value to the controller from view... is there any way to solve that case? – Sue May 17 '11 at 02:06
  • @Sue: You can use `postData: {myParam: function() { return $("#myHiddenField").val(); }}`. In the case the additional parameter `myParam` with the current value from the field with `id="myHiddenField"` will be send to the controller **on every** grid load/refreshing. If the hidden field has an initial value it will be send at the page load. – Oleg May 17 '11 at 07:25