Sorting with HTML and fnrender
Sorting with HTML and fnrender
Hello, first of all I'm deeply sorry, cause I think the solution is still there, but I couldn't figure it out. I've tried the plugin-ins, the answers in this forums, even some samples on github crashed my table :-D My request: I want to sort html-columns with the fnrender-function... not as a string, but with nummeric.
My "problem" looks pretty simple: Most of my columns have html-code, which were rendered before, e.g.
[code] "aoColumnDefs": [ { "fnRender": function ( oObj ) { return '' + oObj.aData[2] +''; }, "sType": "html", "bVisible": false, "asSorting": [ "desc" ], "aTargets": [ 2 ] } ][/code]
...basically it's wraps the value with a link from a different column. For some reasons it's not possible combining them before.
With strings, it's no problem, but not with numerics. It sorts - even with numbers - as a string. So datatables sorts it like
[code]9988
99
979[/code]
...for sure, it has to be:
[code]9988
979
99[/code]
Hopefully there is somebody who could help me. I've already tried http://datatables.net/plug-ins/sorting#numbers_html and http://datatables.net/plug-ins/type-detection#numbers_html but it doesn't work. Maybe I made something wrong.
Sebastian
My "problem" looks pretty simple: Most of my columns have html-code, which were rendered before, e.g.
[code] "aoColumnDefs": [ { "fnRender": function ( oObj ) { return '' + oObj.aData[2] +''; }, "sType": "html", "bVisible": false, "asSorting": [ "desc" ], "aTargets": [ 2 ] } ][/code]
...basically it's wraps the value with a link from a different column. For some reasons it's not possible combining them before.
With strings, it's no problem, but not with numerics. It sorts - even with numbers - as a string. So datatables sorts it like
[code]9988
99
979[/code]
...for sure, it has to be:
[code]9988
979
99[/code]
Hopefully there is somebody who could help me. I've already tried http://datatables.net/plug-ins/sorting#numbers_html and http://datatables.net/plug-ins/type-detection#numbers_html but it doesn't work. Maybe I made something wrong.
Sebastian
This discussion has been closed.
Replies
[code]"bUseRendered": false[/code]
I could handle everything.