Sort issues after adding thumbnail column
Sort issues after adding thumbnail column
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
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
This discussion has been closed.
Replies
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.
For example:
"aoColumnDefs": [{
"bSortable": false,
"aTargets": [ 0 ]
}]