MVCGrid.Net
MVCGrid.Net copied to clipboard
Grid in Modal cannot be reloaded.
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 !
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.
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 !
How can you add the clear function, @Arsaphes ?