Column sorting doesn't work

Column sorting doesn't work

MarconianMarconian Posts: 5Questions: 0Answers: 0
edited September 2011 in General
Hello, people!

Here I am again with a problem that I'm sure many here have faced already.

I have a table with 3 columns: one with sorting working fine, another not sortable, and the problem is with the third column, which is a numeric column. When I click on the column header to sort it, it just says "Processing...", but won't sort. My intent is to hid this third column and use iDataSort on the second column to sort by this third one, but once I can't get the sorting working, I can't do it.

If you could please take a look at http://myminnesotagolfcourses.com/minnesota-golf-course-reviews/ which is fed by http://myminnesotagolfcourses.com/minnesota-golf-course-reviews/server_processing.php and tell me what is wrong, I would be thankful.

Thanks in advance for any kind of help.

-
Marcos Alves

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    You just seem to have an error. Here's the response when trying to sort on the third column:

    Unknown column 'review_rating' in 'order clause'

    So you're not even getting a new data set, just an error in the response.
  • MarconianMarconian Posts: 5Questions: 0Answers: 0
    Wow! You're really fast, GregP! Thanks AGAIN for helping me!

    1) How can you see these errors? I'm struggling here to debug because I can't see the errors :-(

    2) I fixed the SQL code and now the sorting of the third column works fine. However, I don't know why but I can't use iDataSort on column 2 to sort by column 3. Once I'm able to do it, I'll hide this column ("bVisible": false). Can you help me on this? You can check it in the same URLs I posted before. The code I'm using is:

    [code]"aoColumns" : [ { "sWidth": "60%" }, { "iDataSort": 2, "sWidth": "32%" }, { "sWidth": "3%", "sType": "numeric" }[/code]

    3) Finally, how can I sort based on two columns: i.e. to sort by column 3 and then by column 2, so when I click on column 3 header (average rating) the table will be sorted by the average rating followed by course name, alphabetically.

    Thanks,

    -
    Marcos Alves
  • MarconianMarconian Posts: 5Questions: 0Answers: 0
    I could find the answers myself \o/. I don't know if I'm using the best approach, but it's working :-)

    1) I discovered that FireBug is an excellent tool to debug DataTables!

    2) and 3) I fixed in the server side PHP script.

    Thanks for all the help!

    -
    Marcos Alvers
  • GregPGregP Posts: 500Questions: 10Answers: 0
    No problem, Marcos! And indeed it was Firebug that showed me the original error. It's absolutely indispensible. Chrome's developer tools and IE has the f12 developer tools that aren't bad. I use those when debugging for other browsers, but most of my debugging is done with Firebug.

    greg
This discussion has been closed.