I have 3 columns – Ticket number, amount1 and amount2.
To get the grandtotal for amount1 and amount2, we used “showGrandTotals” : “on” in options and used “aggregation” : “sum”. And sorting is happening correctly (ascending and descending) for amount1 and amount2 columns.
But for ticketNumber, it’s sorting based on the first character of the ticket number. It is not considering the entire ticket number for sorting -> because of which sorting is not happening as expected.
Code used in Slice -> Rows:
Code used in Measures:
While using the above code, Ticket Number sorting is not working as expected.
Also when I changed “aggregation” to “sum” for ticket number in measures, I am able to sort the ticket number properly but grand total of all the ticket numbers is being displayed. But i should not show the grand total for ticket number.
Can you please provide a solution for this ASAP!
Thank you for posting to our forum.
After investigation of the provided info, our team came up with an idea why sorting is not performed correctly. Perhaps, the type of the
"ticket" field in your dataset is
string. Thus Flexmonster does not treat the values as numbers.
If our assumption is correct, please use custom sorting for the
"ticket" field: https://www.flexmonster.com/doc/custom-sorting/.
In case this suggestion does not work for you, could you please provide us with an example where the issue is reproducible? It would be great if this sample will contain your data and report, so we could understand the full contours of the situation.
Looking forward to your response.
Thank you for your response.
We could not sort the ticket even by changing the datatype of the ticket to type Number.
Here is the link of our code snippet.
In the above code, below is what we needed:
-> Ticket should be aligned left.
-> Grand Total for Ticket should not be shown but it should be shown for Price.
-> Sorting must happen correctly.
The solution for this as soon as possible will be of great help!
Thank you for providing us with an example.
We have modified it according to your needs: https://jsfiddle.net/flexmonster/q5kabm9r/.
To align the text in the
"Ticket" column to the left, we added the
"leftAlign" format to the
formats. Sorting was set using the
flatSort property of the slice.
Speaking of removing the grand total of the
"Ticket" column, using options you can either enable or disable it for all columns on the grid. However, there is a workaround for your case. In the example, we changed the text of the grand total cell to
" " via
customizeCell API call: https://www.flexmonster.com/api/customizecell/.
For your convenience, we would like to suggest a quick way to configure formatting and slice: just use Flexmonster UI to change the grid view and save the report. In this report, you will see all needed configurations. Please find some tips on how to use UI for your case below.
In the sample above, hover a mouse over the hierarchy name and use an arrow to sort the column. To add formatting for the
"Ticket", click Format -> Format Cells in the Toolbar. Press the Save tab to save your report.
Please let us know if our answer helped.
Thank you so much!!