Wierd sorting problem with server side script

Wierd sorting problem with server side script

zoko2902zoko2902 Posts: 7Questions: 0Answers: 0
edited August 2010 in General
Hi to all!

I have a bit of a problem which i cannot resolve for the life of me, but I'm sure it's just something I overlooked so any sort of input would be great.

In short I've been using datatables to display a table with a little over 4000 records, and with ajax it works flawlesly like always. Column sorting, search, adding removing rows etc. The problem is that it won't sort the records by first column when (desc or asc) data it recieves are row id's.

Columns I'm using are ID, Name, Description, tags, and I want it to sort the data on intialization by ID desceding. If I use the column order like this, it doesn't work but if I put ID on any other place (for instance, Name, ID, etc.) it works like a charm (even sorting by Name works which is now the first column). First I thought it was a data type problem, but it isn't, only column ordering change makes it work.

With a little bugging and debugging in my server side script i found out that when ID is the first column, datatables doesn't send the required data for SQL (ORDER BY part). When I change ordering it, voila, no problem...

Does anyone have an idea what's going on? I'm going on a brake now, beacause I'll start seeing dead people because of this...:)

P.S. i can post the code if it will be of any help
This discussion has been closed.