jqGrid resize event and the event triggered when page is refreshed

861 views Asked by At

I have a jqGrid in my page and I want to know when does the resize event occur. Will it occur when I refresh the page? If not, what event occurs when the page containing the grid is refreshed. I would like to capture the event to alter it's width when the page is refreshed.

1

There are 1 answers

3
Brian Swift On

A page refresh causes a postback, so jQuery/jqGrid events aren't really going to detect a refresh so much as the page loading.

Depending on your goals, I would suggest either the jQuery .ready() method or the jqGrid gridComplete() method to handle grid resizing any time someone opens or refreshes the page.

Which one you use will likely depend on whether the actual data that the grid receives is going to influence how large you want to set the grid.

If the data doesn't matter and you just are concerned about the size of the browser window, I would use .ready() and pre-populate your grid configuration with the appropriate size.

If the data does matter, you'll probably want to use the gridComplete method on your jqGrid.

If you want to be able to adapt your grid size when the user resizes the browser, see this answer: Resize jqGrid when browser is resized?