On Tuesday, January 16, 2018 at 1:01:54 AM UTC-5, Tu Duong wrote:
>
> I have more than 1 grid on the same page (about 10). I could do it, but it
> is not a best solution because I need to keep track of which gird is
> visible, hide that grid, and show the new selected one. I hope there is a
> better way to solve this... wondering why it does not work. It works
> beautiful with form
The grid HTML includes some single quotes, so you cannot wrap it in single
quotes in your Javascript code, as you have done. Depending on which
browsers you need to support, you can instead put the grid HTML inside a
Javascript template literal. Alternatively, put each grid in a hidden div,
and simply copy a given grid to the visible div whenever you want to show
it:
jQuery('#visible_div').html(jQuery('#hidden_div_1').html());
Also, rather than building all the grids when the page is first requested,
you might consider loading each grid asynchronously via Ajax only when
needed. For example, clicking a button could call $.web2py.component() to
retrieve a given grid as a web2py Ajax component.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.