Sorting display data

Sorting display data

PlaxmaPlaxma Posts: 9Questions: 2Answers: 0

I want to sorting data based on it's display data after the data being rendered.

Data on column 2 depend on column 1..
That render using this format row.floor + ': ' + row.dept
The display work well, but when I tried to sort everything sort randomly

Here the example output that I want to achieve from this live example
Floor | Dept
1 | 1: account
~~null~~ | boss
five | five: ict
~~null~~ | journal
seven | seven: academy

Here the example but I also don't know what is the error
http://live.datatables.net/dibuxati/1/edit

I also has use 'data' as well before and also 'row'
Also tried using 'type'
I also have read orthogonal data & rendered section few times but still don't get it

Thank you

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921

    I fixed your example, lots of syntax errors :smile: Plus you need to use data to provide the data to Datatables:
    http://live.datatables.net/dibuxati/2/edit

    The data is being sorted as a string where numbers come before letters. Its sorting as I would expect. How do you want to change the sorting?

    Kevin

  • PlaxmaPlaxma Posts: 9Questions: 2Answers: 0
    edited November 2019

    Thank you, :# :# for fixing that error

    I see,, the data is really sort the way I hope in this example..
    http://live.datatables.net/dibuxati/3/edit

    But in real life it sort differently, it ignored the 'floor' but just sort the data according 'dept' only.. Just assuming 'floor = folder' , 'dept = movie' but with still same data structure..

    Here's the result that I get

    I use the same code as live example only change it to floor & dept only.. The only difference data come from AJAX,..
    Any idea or suggestion why it sort like that?

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921
    Answer ✓

    Ajax shouldn't matter unless you have serverSide: true enabled. In order to help we will need to see an example replicating the issue. Can you update the test case to replicate the issue?

    Kevin

  • PlaxmaPlaxma Posts: 9Questions: 2Answers: 0

    Wow great.. After I changed ServerSide to false. Everything work perfectly as I hope :) :)

    Thank you so much :) :) :)
    Have a very nice day o:)

  • PlaxmaPlaxma Posts: 9Questions: 2Answers: 0

    Also, is there anyway to achieve same result with ServerSide: true ?

    Thank you

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    When serverSide is enabled, it's up to the server to do all the sorting, so you would need to implement that in your server side script or SQL queries.

  • PlaxmaPlaxma Posts: 9Questions: 2Answers: 0

    Thank you collin :) :)

This discussion has been closed.