Below is the result set that I am currently displaying
Order_by | Country | Capital | Continent |
8 | United States | Washington | North America |
20 | Australia | Canberra | Australia |
5 | Russia | Moscow | Europe |
77 | Ottawa | North America | |
88 | Denmark | Copenhagen | Europe |
288 | Iraq | Baghdad | Asia |
165 | Japan | Tokyo | Asia |
3 | China | Shanghai | Asia |
50 | New Zealand | Auckland | Australia |
90 | Nigeria | Lagos | Africa |
The columns Country,Capital and Continent as all sortable columns where users can sort them either in ascending or descending order. But at the same time I want the value in order by column updated as well. Lets say If I sort Country in ascending order then the resultset should look like this:
Order_by | Country | Capital | Continent |
3 | Australia | Canberra | Australia |
5 | Ottawa | North America | |
8 | China | Shanghai | Asia |
20 | Denmark | Copenhagen | Europe |
50 | Iraq | Baghdad | Asia |
77 | Japan | Tokyo | Asia |
88 | New Zealand | Auckland | |
90 | Nigeria | Lagos | Africa |
165 | Russia | Moscow | Europe |
288 | United States | Washington | North America |
and same is the case of other columns. sorting any column also sorts and updates the value in order_by column. I am using a simple