Tuesday, July 4, 2017

Re: django-tables2 and javascript



On Jul 4, 2017 1:31 PM, "yingi keme" <yingikeme@gmail.com> wrote:
I want to know. How do you access a table generated by django-tables2 in your client side using javascript?

Does django-tables2 provide a mechanism to access table contents via client side.? A traditional html <table> tags do have an id or a classname for access purpose. How will you do such with a django generated table.?

You can add an HTML class or id to the <table> tag by specifying it in your python Table class:


Once that is done, you can identify the table in the DOM with JS and perform whatever manipulations you need.

To answer your question specifically, Django-tables2 is strictly server-side, so there is no direct connection between it and your JS (which is only client-side).

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWSDDUT%3Dj_hTsbFtQ6H4A30rGVPMLs3SLA%2BzcRcAAgWOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment