Sorting stopped working (JSON)

Sorting stopped working (JSON)

PaweoPaweo Posts: 6Questions: 0Answers: 0
edited July 2011 in General
Hello
Firstly I'd like mark that I appreciate your work. DataTables are really useful.
Unfortunetely I have some problem with them. I am using JSON as a source.
I have changed script/json.php file and then sorting stopped working. Could you
please help me how to change sorting lines to start it working back?

I've changed only:

[code]
$aColumns = array( 'id', 'make', 'model', 'description');
[/code]

and:

[code]
$sQuery = 'SELECT cars_cars.id, model_id, description, model, make
FROM cars_cars, cars_model, cars_make
WHERE cars_cars.model_id = cars_model.id
AND cars_model.make_id = cars_make.id';
[/code]

It works great for presenting data, but not for sorting.
Thank you in advance
Paweo

Replies

  • PaweoPaweo Posts: 6Questions: 0Answers: 0
    I've solved it my self. I have forgotten about adding $sOrder value to the query, so the correct version of aboven code is:
    [code]
    $sQuery = 'SELECT cars_cars.id, model_id, description, model, make
    FROM cars_cars, cars_model, cars_make
    WHERE cars_cars.model_id = cars_model.id
    AND cars_model.make_id = cars_make.id'.' '.$sOrder;
    [/code]
This discussion has been closed.