0

I tried but reload is triggered only after alert is shown ex:

$("#gs_title").val('test');
$('#mygrid').trigger('reloadGrid');

nothing.

$("#gs_title").val('test');
alert('loaded');
$('#mygrid').trigger('reloadGrid');

works (data reloaded). I can't figure why, but using $("#mygrid")[0].triggerToolbar() does not works too.

Daniele Cruciani
  • 623
  • 1
  • 8
  • 15
  • It is important **where** you insert the lines. Could you modify the text of your question and include more full JavaScript code which you use. You problem is not what you do, but **where** and **when**. – Oleg Apr 06 '11 at 16:50
  • Actually I solved by $('#mygrid').delay(1000)[0].triggerToolbar(); – Daniele Cruciani Apr 08 '11 at 08:27

2 Answers2

1

Probably the demo from the old answer do what you want.

UPDATED: Another demos: this and this can be another way to implement not what you do, but what you probably need: to filter the data at the load time. (see this answer for example)

UPDATED 2: You don't posted more code, so it's difficult to comment the code. Moreover you don't explain what you want to do, don't describe the context. It can be for example, that you have jqGrid which will be filled with remote data (datatype:'json' or datatype:'xml'). In the case the reloadGrid will be ignored till the previous ajax call not ended.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Actually I solved by $('#mygrid').delay(1000)[0].triggerToolbar(); but I like http://www.ok-soft-gmbh.com/jqGrid/MultisearchFilterAtStart.htm postData at start probably is the better solution for me. (the code is just below the jqGrid setup) – Daniele Cruciani Apr 08 '11 at 08:33
  • @Daniele Cruciani: Look at the "UPDATED 2" part of my answer. Probebly it was the reason of your original problem. – Oleg Apr 08 '11 at 08:40
0

Are you sure you're waiting for the DOM to load?

$(document).ready(function()
{
  $("#gs_title").val('test');
  $('#mygrid').trigger('reloadGrid');
});
Blender
  • 289,723
  • 53
  • 439
  • 496