Things that you want to do in the browser should probably be done in the browser. If so, then Django isn't directly involved, until you want to persist the changes.
There are a number of JavaScript libraries that support dragging things around a table. Long ago I did something like this using, I think, YUI (from yahoo), but I'm sure that tools have moved on since then. Personally, I now try to stick to things that leverage jQuery and jQueryUI, since I tend to load them anyway.
You almost certainly will be tweaking your templates to feed the JS the information that it needs, though there may be libraries that can be pointed at virtually any table.There are a number of JavaScript libraries that support dragging things around a table. Long ago I did something like this using, I think, YUI (from yahoo), but I'm sure that tools have moved on since then. Personally, I now try to stick to things that leverage jQuery and jQueryUI, since I tend to load them anyway.
If you're going to persist the changes without waiting for a submit button, then you need to AJAX the ordering information back when it changes. If you only save later, you still want a library that makes it easy to extract the current ordering.
Remember to do things with CSS when possible. For example, hiding a table column: Rather than traipse through all the th and td for that column, setting display none, it is better to add/remove a class to the table tag (or some outer element) that triggers a CSS rule making display none. It is surprisingly easy to trigger IE to pop up "A script is taking to long. abort? continue?".
On Wed, Jul 31, 2013 at 5:25 AM, Nigel Legg <nigel.legg@gmail.com> wrote:
--Any suggestions of how to do that gratefully receivedThe attached screenshot, simpletab, shows the simple cross tab I have created using Django (my first functioning app). This takes in a csv data file and an xml definition file. The user selects the variables they want to see, and the table is created.My question is that the user may want to flip the table round, or add new variables to the table. I'd quite like to do this as a drag and drop thing, would I have to do this using javascript or something else? I assume I can't use Django - am I wrong is thinking that?
Thanks, N//
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment