MVCGrid.Net icon indicating copy to clipboard operation
MVCGrid.Net copied to clipboard

Grid in Modal cannot be reloaded.

Open Arsaphes opened this issue 8 years ago • 3 comments

Hello,

I open a grid in a modal popup (bootstrap Modal) using the js function modal("show"). Then, after updating or inserting an item, I can't refresh the grid using the function MVCGrid.reloadGrid. The grid is not found. In the dynamic script.js file, the value currentGrids only contains the main web page grid, not the one in the modal.

How can I access my modal grid ? Any option with @Html.MVCGrid() ? Any trouble with the dynamically generated grids ?

Thanks a lot for your help !

Arsaphes avatar Feb 22 '17 15:02 Arsaphes

I have not tried displaying the grid in a Modal. Could you send me a SSCCE (http://sscce.org) and I can see if I can help debug.

joeharrison714 avatar Mar 08 '17 02:03 joeharrison714

I've found a solution for that. I noticed that the function 'init' from the 'script.js' file is called each time a page is loaded. Problem is: a modal doesn't call it, and the MVC grid is not in the DOM. So, the MVCGrid doesn't exist in the 'currentGrids' array. I added a function 'reset' that clear the 'currentGrids' array first to avoid adding the main page grid a second time and call the 'init' function. As a matter of fact, I finally have the modal popup grid in the 'currentGrids' array and all the needed interactions. Anyway, thanks very much for the job, it's my favorite grid view !

Arsaphes avatar Mar 09 '17 21:03 Arsaphes

How can you add the clear function, @Arsaphes ?

tqduy avatar Dec 07 '17 13:12 tqduy