Django for Data Tables to group by when coloumn hidden

51 views
Skip to first unread message

Sid

unread,
Dec 9, 2015, 10:07:16 AM12/9/15
to Django users

Question: I have a Data table displaying on django , but now I like to group by when ever I will hide the column.


column1 column2 column3

AAA        CAD    25

AAA        USD    12

BBB        CAD    13

BBB        USD    16

CCC        CAD    11

CCC        USD    18


The above table will be displayed on web page using Django, now when ever I hide column2 It should group by and display like below table.


column1 column3

AAA                  37

BBB                  29

CCC                  39


when ever I unhide it again it should display same as first table again.

can anyone tell me there is any possible way to do it.


Thanks in advance.

Carsten Fuchs

unread,
Dec 10, 2015, 12:29:28 PM12/10/15
to django...@googlegroups.com
Hi Sid,

if with Data Tables you are in fact referring to http://datatables.net/, then you should
put your questions with the folks over there. I guess what you want is possible with
DataTables (I haven't checked), but be prepared for some customization with JavaScript
being required.

If you want to solve the problem in pure Django (that is, with no JavaScript help on the
client), I would probably create two different views, one for the table with and the
other without the second column. The docs at
https://docs.djangoproject.com/en/1.9/topics/db/aggregation/ explain very well the
concepts that you need in order to build the table with the second column collapsed.

Best regards,
Carsten



Am 09.12.2015 um 16:07 schrieb Sid:
> *Question:* I have a Data table displaying on django , but now I like to group by when
> ever I will hide the column.
>
>
> *column1 column2 column3*
>
> AAA CAD 25
>
> AAA USD 12
>
> BBB CAD 13
>
> BBB USD 16
>
> CCC CAD 11
>
> CCC USD 18
>
>
> The above table will be displayed on web page using Django, now when ever I hide
> *column2* It should group by and display like below table.
>
>
> *column1* *column3*
>
> AAA 37
>
> BBB 29
>
> CCC 39
>
>
> when ever I unhide it again it should display same as first table again.
>
> *can anyone tell me there is any possible way to do it.*
>
>
> Thanks in advance.
>


Sid

unread,
Dec 14, 2015, 9:49:08 AM12/14/15
to Django users
Thanks for your reply Carsten. I want to use javascript...I will try to put my question on data-tables as per your suggestion .

But thanks again for your reply :)
Reply all
Reply to author
Forward
0 new messages