Display data, sort by other (not the same) data.

Display data, sort by other (not the same) data.

neurofunkneurofunk Posts: 14Questions: 5Answers: 1
edited June 2015 in Free community support

Hello.

I'm tryin to rebuild my simple home-made "application". I made this with with php only, but when I saw datatables... You know, that's awosome ;) Everything works fine, but I have only one problem.

For simplified example: I've got three columns from database, (based on this example - https://www.datatables.net/examples/server_side/row_details.html):

array('db' => 'serial_name' , 'dt' => 'serial_name' ), array( 'db' => 'episode', 'dt' => 'episode' ), array( 'db' => 'episode_number', 'dt' => 'episode_number' ),

I want to display episode in table column, but it should be sortable by episode_number, and the episode_number must be hide. Why? I want to display for example:

House MD | s2e02
Breaking Bad | s2e02
Dexter | s1e10

I want to sort column by episode_number becouse in fact all of these three records are not equal and 'Dexter' should be higher in order than 'Breaking Bad' (House s2e02 = 24 episode, BrBa s2e02 = 9, Dexter s1e10 = 10).
In my old pure-php-way it's simple, but I have no idea how to do this using datatables.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.