How to make a list-view sortable in frontend?

272 views
Skip to first unread message

ThomasTheDjangoFan

unread,
Feb 17, 2015, 5:43:13 PM2/17/15
to django...@googlegroups.com
Hi 'ya,

I am new to Django and would like to create a sortable ListView (just like the Lists in Django Admin) for an array of object-instances. The objects themself are non Django-Models and are pre-populated in an array before showing the view.

I've got a basic ListView working (https://docs.djangoproject.com/en/1.7/topics/class-based-views/),
but the important question remains: How do I make it sortable?

Can you give me to some examples to check out how to implement a sortable ListView?

Kind regards and thanks a lot for your support
Thomas

James Schneider

unread,
Feb 17, 2015, 5:51:25 PM2/17/15
to django...@googlegroups.com

Are you displaying the data in a table? If so, I've always used django-tables2, which includes the ability to have sorting in each of the columns via a generated link in the header row of any or all columns (up/down arrow, etc.).

-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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9676838b-9df9-46c0-8b57-b1e4aa43ecce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ThomasTheDjangoFan

unread,
Feb 18, 2015, 5:01:12 AM2/18/15
to django...@googlegroups.com
Hi James,

yeah - the data is displayed as a table..

django-tables2 looks awesome... I'm gonna give it a try.

Are there any other solutions out there that you can recon?
Reply all
Reply to author
Forward
0 new messages