ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: pquser on September 15, 2017, 04:08:50 pm
-
Hi,
in my table there are values like "2,5 pieces", "4,00 pieces" and such.
I want to set up my colModel in order to handle this string values as float and sort them in the correct order.
If I just set "dataType" to "float" they are not sortable any more.
Guess I need some javascript magic in here.
Any Idea how to do this?
Thanks.
-
values like "2,5 pieces", "4,00 pieces" can't be sorted like floats.
Workaround is to use formula to extract float values form strings using a regular expression and store in a separate column.
Let's say column having values like "2,5 pieces", "4,00 pieces" has dataIndx = 'a'.
Add another column with dataIndx = 'b'
use row formula to extract float values from column a and save in column b.
Keep column a as hidden and column b visible.
use render function in column b to display corresponding string values from column a.
-
No need for such a hack as I can change the SQL query to deliver "pieces" as an extra column.
If I do so, will setting the type to "float" work with a comma as decimal separator (German) instead of a dot? Or will I need to do some adjustment javascript wise?
Thanks.
-
If I do so, will setting the type to "float" work with a comma as decimal separator (German) instead of a dot? Or will I need to do some adjustment javascript wise?
Seems it doesn't. I can't sort fields with decimal comma any more when set to "float".
Any hint how to fix this?
-
As you have access to data source/ sql query, it's quite simple.
1.return the data as true float values as 1234.56 which would ensure correct sorting.
2 and use column.format = "#.###,00 pieces" to display it in the format you wish to your users.