Uzairkhan92 Posts: 36Questions: 10Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi, Above I have attached my demo grid.
I am unable to sort my grid although gird sorting was working fine and still having issues in the sorting of the last column *Todays Gain/Loss" in the grid.
You are getting this error:
Which is caused by this statement:
That suggests the
array index is out of bounds. Not sure what you goal is but you should validate the result of
data.split(' ')before trying to access the resulting array.
The error is causing the Datatables functions to no work.
Can you plz fix the problem in JS fiddle file, actually the last column of the grid is not sortable, It's not sorting properly grid data?
I did the exact work on other places its working fine.
As I said I don't know what you are trying to do with the above statements. I commented them out here and sorting works:
If any of the columns isn't sorting as you want then tell us how you expect it to sort.
Here is the URL of my DT grid. The last 3 columns are not sorted properly.
In the columns, there are mixed data, strings, numbers, and special characters, and also some negative values are there in the grid as well.
But Datatable default sorting is not working.
Can you plz check it out and guide me to the solution or fix the issue of the sorting.
You're going along the right path with
columns.render, you just need to determine what you want to sort by. The "Cash" column appears to work, but the others are returning values like "(2.15%)" which would be treated like a string,
So can you plz set a demo example? So that would be easy for me to understand.
You have data like this in the last two columns:
I want to sort in Ascending and descending order, positive and negative values as well. The problem I am facing right now last column of the grid is not sorting orderly.
In negative values its showing the wrong sorting order.
The question is you have two numbers
2.15%in those columns. Which do you want to sort by?
I want to sort From 1st number 21,457.
I want to sort from 21,457
The first thing to do is to use regex101.com to build the proper regex expression to extract the data you want. You need to use everything in the cell including the
itag. For example:
The matched group has your number. For example: