Hi Tobias,
Thanks for the swift reply. I added the code suggested but it did nothing. I’m also confused as to what that means, can you explain?
As for the ranges; I don’t know what to do, as what you’ve linked then links to another 4-5 threads, with multiple different solutions.
Adding an extra column to hide is fine, but that would solve the “Tested Range” but won’t work on the “Claimed Range”, so how will the table know to sort it properly when there are two sets of ranges from two sets of data points? If that makes sense? I presume I can’t create two hidden columns to then have “Tested Range” sorting via the hidden column No1, while “Claimed Range” would base it on hidden column No2?
I’m really not sure what code I’d have to input here? Was hoping TablePress would be simple to use, but it’s now causing me a headache :/
Edit, my wife suggested I ask ChatGPT and it’s worked…!?
Here’s the code:
"columnDefs": [ { "orderData": [ 1 ], "targets": [ 2 ] }, { "visible": false, "targets": [ 1 ] }, { "orderData": [ 3 ], "targets": [ 4 ] }, { "visible": false, "targets": [ 3 ] }, {
targets: [5, 6],
render: function (data, type, row) {
if (type === 'sort' || type === 'type') {
// Extract first number (supports decimals & negatives)
let num = data.toString().match(/-?\d+(.\d+)?/);
return num ? parseFloat(num[0]) : 0;
}
return data; // keep original text for display
}
} ]
Note ChatGPT said this:
“num-fmt only works for:
1,234
1.234,56
- clean numeric formats
❌ It does not strip text
❌ "15 days" will never sort numerically”
Could you let me know if the above is all correct?
Also it’s worth noting that with what you suggested for the number range, the arrows no longer appear when sorted. Why is this?
-
This reply was modified 4 months, 2 weeks ago by
Chris.
-
This reply was modified 4 months, 2 weeks ago by
Chris.
-
This reply was modified 4 months, 2 weeks ago by
Chris.