Sorting numeric column and handling blank value
Sorting numeric column and handling blank value
bczm8703
Posts: 16Questions: 5Answers: 0
I am integrating datatable with asp:gridview. the columns are dynamically created at runtime. when I tried to sort the numeric column, the blank data caused the whole column to be sorted as string.
my numeric column contains the following possible data
numeric column
1,234,567
234,567.89
213
-2,123,678
This question has an accepted answers - jump to answer
Answers
i have did a test case
refer to the count column
It's because that "numeric" column isn't numeric - it has HTML and values with a comma. You can use the numeric-comma sorting plugin, or use
columns.render
(withorder
) to strip those non-numeric characters/strings out.Colin
but it will required me to know which column to set as numeric-comma type before runtime? my columns build and create only at runtime after getting the column type from the database
The other option is convert those non-numeric HTML fields for all fields - see here.
The numbers are fine, I was mistaken there, your language settings were dealing with those correctly.
Colin