40322

jqGrid - event on grid initialization

I'm using jquery jqGrid plugin and I need to fire event on grid initialization. I tested gridComplete and loadComplete events, but these events raised after every server request. I need an event that raise <strong>just once and after initialization of the grid</strong>. I read jqGrid events list, but I don't see any related event to my requirement. Is there any way? Thanks for your attention.

<strong>Update:</strong>

Thanks to @Oleg for his answer. I'm using jqGrid 4.6 and used @Oleg's suggested events with this pattern:

$('#grid1').jqGrid('setGridParam', { onSelectRow: function(id) { //This event raised without problem. }, onInitGrid: function(){ //This event does not raised. }, jqGridInitGrid: function(){ //This event does not raised. }, });

But this is not working. What is the correct way to use these two events?

Answer1:

If I understand your requirements correctly the jQuery event jqGridInitGrid or onInitGrid callback is what you need. It's the first events/callbacks which will be called once during creating the grid after the outer part of jqGrid will be constructed and before the first filling of jqGrid with data. The event/callback can be used in jqGrid 4.6/4.7

The new version of free jqGrid, which I'm developing now, contains additionally beforeInitGrid callback and jqGridBeforeInitGrid event. The callback/event will be called <strong>before</strong> jqGrid start processing of input parameters. So it's possible for example make any modification of the parameter. You can for example modify/generate colModel based on the input data.

So the best choice of the callbacks/events depend on at what moment of initialization you need to do some changes and from which version of jqGrid you use.

Recommend

  • how to create sql WHERE clause from jqgrid multipleGroup filter condition in ASP .NET MVC2
  • import subpackages with golang, by importing parent dir?
  • jqGrid: Search form changed to be flat?
  • how to remove delete action icon from confirmed order rows in jqGrid if clickableCheckbox formatter
  • Explicitly set a cell’s datatype as text for number values
  • Is there a better way to run CLI commands with Node.js?
  • call monodroid method from javascript example
  • g++: error: CreateProcess no such file or directory
  • Rails - Redundant RESTFUL Actions for map.resources? (new, create)
  • FIR filter in CUDA (as a 1D convolution)
  • How to create L lists of n non-zero random decimals where each list sums to 1.0?
  • How to run requests.get asynchronously in Python 3 using asyncio?
  • How to notify a specific thread in Java
  • typescript: any difference between number[] and [number,number]?
  • Redis under Classic ASP(VBScript)
  • Criterion causing memory consumption to explode, no CAFs in sight
  • Specify the x-axis values in ggplot in R
  • Why cepheus don't send int without quotes to orion?
  • Why use database factory in asp.net mvc?
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • How to define and use opencv mat of user type
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • WinForms: two way TextBox problem
  • Join two tables and save into third-sql
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • Jquery - Jquery Wysiwyg return html as a string
  • R: gsub and capture
  • Arrays break string types in Julia
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • WPF Applying a trigger on binding failure
  • log4net write single file for each call to log.info
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • Understanding cpu registers
  • how does django model after text[] in postgresql [duplicate]
  • Java static initializers and reflection
  • Cant find why the layout is getting smaller
  • Add sale price programmatically to product variations
  • Converting MP3 duration time