First time using DataView component to list records in a BS Table…
I have a serverconnect with a multi records query. Then I add a DataView and assign its Data Source to that query.
I’m trying to have my table data sorted on a DataView column by setting the DataView Sort on attribute sorton="ord_Total" (ord_Total is the DataView Column).
But it didn’t work like that, and my results were not correctly sorted (although Sort direction has an effect)
Here is a Ascending sort:
And here is Descending sort:
After a few tests I ended-up that the problem is if I assign a column type of Decimal.
If I sort on a Numeric or String type filed it is ok.
If anybody can give me an idea of what I’m doing wrong or how this can be handled it would be great.
It looks like ord_Total is a string rather than a number, hence the 1 comes first, then 30 then 38. You’ll need a column that is a number in order to sort properly.
I tried setting the Sort on to sorton="ord_Total.toNumber()" but no luck…
Unfortunately, in my case I cannot easily modify my server action because it is a complex one (paged query with a few joins(inner & left) and 2 level of nested subqueries and all of these with a complicated set of conditions based on $_GET parameters…)
So, there is no way of getting a proper sum on queries decimal columns?
Please somebody drop an idea here and save me from making all this ServerAction from scratch…
So, I added a Repeat based on the query with the decimal Totals, and assigned all the original values from the query except the ord_Total that I assigned the ord_Total.toNumber().
And on client-side I set the DataView source to the ArrayList value ,instead of the original query …
Little more heavier for the server but works fine and no major handling changes on Client-Side.