lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

Index changes when searching / sorting #731

Closed ghost closed 7 years ago

ghost commented 7 years ago

When sorting a table or filtering a table the indexes are recalculated. So what used to be index 64 can now be index 0 when by sorting the table this row is now the first row.

Anything we can do about this?

ghost commented 7 years ago

Anyone wondering. I've sort of fixed it for now by adding another value to the array called original_index and just using that further on in the code.

Did it by having PHP add it to the array before spitting it out as JSON:

        $i = 0;
        while ($row = $result->fetch_assoc()) {
            $row["original_index"] = $i++;
            $json[] = $row;
        }