oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
424 stars 82 forks source link

order_by / sort in listview #91

Open A4TIF opened 5 years ago

A4TIF commented 5 years ago

I believe this is going to be a feature request. I think we should have sorting/order_by for columns. This will be helpful for a lot of people I'm sure.

luisza commented 5 years ago

Hi, you can explain better this feature? What are you thinking about, how be show. Thanks, maybe I can help to insert this feature.

A4TIF commented 5 years ago

Hi

Well I was thinking something like: https://datatables.net/examples/styling/bootstrap.html

Just like how we have list_fields, list_filter=, we can include list_sorting= and enable sorting on those.

Currently, we can also override get_ordering, and allow fields ordering there, but then we need to make sure while paginating the request maintains the current ordering parameters, which it doesn't at the moment either. {{ getparams }} in pagination only takes care of the filters for now.

Basically once the ordering is enabled, we should show the "asc"/"desc" buttons on the columns and make it work somehow.

OR

We do something drastic, and really cool - DataTables with ajax :) That will super nice, and we can get rid of all the pagination / search code that we have now and use that instead. The challenge there will be with crud columns and perhaps a lot of other things.

Best of luck

A4TIF commented 5 years ago

Hi @luisza .. checking if you got working on this by any chance? I really feel if we can get rid of tables completely and just use divs, that will be really nice. Anyways, awaiting your response. If not, maybe for my next project with django-cruds-adminlte, I can do some modifications too.

A4TIF commented 5 years ago

Hi @luisza - just checking back on this .. any work done so far? I was looking at django_tables2 and it seems to have a good potential for this project. What do you reckon?

luisza commented 5 years ago

Hi, well sound like a good idea, I was working with admin2 and they use datatables2, I don't know if django_tables2 will be the option but maybe datatables2 plain and a rest API could help.

If I can do that, maybe we can remove some html code that are not responsive. What do you think? @alegambo, @luisfelipe7, @GuillermoECS could you work on this in a week ?