Welcome Guest, Not a member yet? Register   Sign In
Backend Database Ordering
#1

[eluser]tomdelonge[/eluser]
So you know when you see a table of data and it has different characteristics that you can sort by? What's a good way to do that? I'm using DMZ (that shouldn't matter), but I would think you'd use $this->uri->uri_to_assoc(n) or something and try to go from there. But then you'd have to list each item in each method. Any better ideas?

How would you do it?
#2

[eluser]Cro_Crx[/eluser]
So you mean a table that when you click on the column headings it sorts the data ascending (for the first click) / descending (for the second click) for that particular row ?

Easiest way would be to pass that info the the URI so for example website.com/information/sort/column/asc then just fetch the uri segments with:

Code:
$column = $this->uri->segment(3);
$order = $this->uri->segment(4);

If you want to be able to sort by more than one row at a time, for example sort by date and then ID second, you could just count the number of URI segments and loop through them accordingly so you would have a uri like: website.com/information/sort/column/desc/another_column/asc/third/desc

Then just count the total segments and use every second column (after the 3rd) for the column name and every other one for the order.


To get the info from DMZ, you can just use their inbuild methods to sort Smile




Theme © iAndrew 2016 - Forum software by © MyBB