Sorting numeric values with empty data
Sorting numeric values with empty data
Hi All,
Facing a issue while sorting the price column . Price contains both currency and value and it seems to be working fine except when there is no price for a given record.
Here is my code snippet:
"columns": [
{ "data": "code" },
{ "data": "name", "defaultContent": "N/A" },
{ "data": "priceData.formattedValue", "type": "num-fmt","defaultContent": "N/A" },
{ "data": "discountPriceData.formattedValue", "type": "num-fmt","defaultContent": "N/A" },
{ "data": "percentageOff", "type": "num-fmt", "name": "percentageOff" },
{ "data": "stagingPriceData.formattedValue", "type": "num-fmt", "defaultContent": "N/A" },
{ "data": "stagingDiscountPriceData.formattedValue", "type": "num-fmt", "defaultContent": "N/A"
This seems to be working fine except when the value is missing and we use "N/A". I can't use 0 for missing data since it will change the complete context for the user and can cause more issue.
This is how my sort look like which is not correct.
Note: I can't share the project URL since it's closed source and not accessible on open network.
Answers
Use Orthogonal data to set
0
for theN/A
values for sorting. See the Computed values example.Kevin