Sort issues after adding thumbnail column

Sort issues after adding thumbnail column

mrbrandenmrbranden Posts: 15Questions: 0Answers: 0
edited December 2010 in General
I added a column to my datatable that displays a thumbnail. It is the first column on the left (column 0?). After adding that column, the table no longer displayed; it just said "processing".

Then I noticed that if you try to sort one of the columns while it hangs on "processing", it will display the table (correctly sorted). But if try to sort by photo, it goes back and stays in that "processing" state until I click another sort. (Note: I have no need to sort by photo, but I'm sure some user will try to.)

I'm thinking it's trying to sort by photo by default, hence why it hangs initially.

I looked at the server-side PHP code and saw this:

[code]
/* Ordering */
if ( isset( $_GET['iSortCol_0'] ) ) {
$sOrder = "ORDER BY ";

for ( $i=0 ; $i

Replies

  • mrbrandenmrbranden Posts: 15Questions: 0Answers: 0
    Of course I figure it out minutes after posting...

    I used the aaSorting parameter to change the default sort column. That fixed both problems. I understand how it fixed the default column problem, but now when I sort by "photo" it simply doesn't sort. That is good, I guess I'm just surprised it fixed that problem.
  • SebastianG86SebastianG86 Posts: 5Questions: 0Answers: 0
    You can disable ordering for specifc columns. Have a look at bSortable: http://www.datatables.net/usage/columns.

    For example:
    "aoColumnDefs": [{
    "bSortable": false,
    "aTargets": [ 0 ]
    }]
This discussion has been closed.