Need a special offer?Find out if your project fits.
+

Reset Sorting on Columns

Answered
Tanushree asked on May 5, 2021

Hello Team,
In the current version of FM, we can click on sorting icons on column header for sort in ascending/descending order.
However, there is no option to reset/remove the sorting.
We were able to remove sorting on a column by double clicking on the column header in FM 2.1 version.
Is there a way to remove sorting on individual columns in new FM?
Thanks,
Tanushree

15 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 5, 2021

Hello,
 
Thank you for posting on our forum.
 
You can reset sorting from the context menu. The context menu can be invoked by the right click on the corresponding header cell. After the context menu is opened, choose the "Clear sorting" option.
 
Please let us know if it works for you.
 
Regards,
Illia

Public
Tanushree May 7, 2021

Thanks Illia.
Unfortunately, we are using right click for a customized menu for our app.
Is there a way to clear sorting by double clicking on the column(s)?
Can we use a doubleClick handler and call an Api to clear sorting?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 7, 2021

Hello,
 
We suggest using the following workaround in order to clear sorting after double-clicking the header cell: https://jsfiddle.net/flexmonster/anqmr82b/.
It uses the celldoubleclick event to retrieve information about the chosen cell and perform corresponding actions.
 
Please let us know if it works for you.
 
Regards,
Illia

Public
Tanushree May 10, 2021

Thanks Illia for your response, that was quite helpful!
We used to display a tooltip in old FM on hover for resetting the sorting, attached screenshot for reference.
Can we do this in new FM?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 10, 2021

Hello,
 
Thank you for your feedback.
 
You can add tooltips using the customizeCell hook provided by Flexmonster. We have complemented the mentioned JSFiddle so that tooltips displayed when hovering dedicated cells: https://jsfiddle.net/flexmonster/anqmr82b/.
 
Please let us know if it works for you.
 
Regards,
Illia

Public
Tanushree May 10, 2021

Thanks Illia for your quick response.
If we load data in the report with default sorting applied on a specific column, then double clicking the header does not remove sorting but resets to default sorting order on that column.
Is there a way to remove sorting completely in this case?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 12, 2021

Hello,
 
Thank you for your feedback.
 
You are right about the fact that the mentioned workaround does not work for some specific cases when sorting is predefined in the report. Still, we did not manage to find another approach that would satisfy all the possible aspects of the configuration.
We have added your request to our wishlist.
 
As for now, we suggest using the context menu for this purpose. You can add the tooltip that would inform user about the correct way to remove formatting.
 
Please let us know if other questions arise.
 
Regards,
Illia

Public
Tanushree May 13, 2021

Thanks Illia,
Could you provide the steps how we can use context menu clear the predefined sorting in FM report?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 13, 2021

Hello,
 
Thank you for your question.
 
We have checked the behavior of the discussed functionality, and it seems it does not work for predefined sorting rules with empty tuple.
 
Our team will investigate possible reasons for the issue and provide you with results ETA June 14.
 
Feel free to contact us in case other questions arise.
 
Regards,
Illia

Public
Tanushree May 13, 2021

Thanks Illia,
We will wait for an update until then.
Tanushree

Public
Tanushree May 14, 2021

Hi Illia,
We are currently using both cellclick and celldoubleclick event listeners in our report.
For reports with drill down rows, following was observed:
After series of ascending/descending sort and the child rows opened in drill down, when double clicked on column header the reset didn't work.
I checked the console logs and found that cellclick handler threw error at this line:
if (cellDataObject.type === "header" || e.rowIndex === -1)
where cellDataObject is:
let cellDataObject = widgets[containerId].flexmonster.getCell(e.rowIndex, e.columnIndex);

and the error was:
Uncaught TypeError: Cannot read property 'type' of null

After this, the subsequent cellclick and celldoubleclick events were not caught in their respective listeners.
I would appreciate if you could try this at your end with Custom datasource api having large data and drill down rows.
How to handle this error and prevent click listeners from being removed?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 17, 2021

Hello,
 
Please note that the mentioned exception is caused by the functionality implemented on your side. We are not able to reproduce this issue without having the entire page available. Provide us with a corresponding example and the exact set of steps so that we could analyze it on our side.
 
Also, note that double-clicking the cell with an expand icon should be used to expand the clicked member. This is why we recommend using the context menu instead.
 
We hope it helps.
 
Regards,
Illia

Public
Tanushree May 17, 2021

Hi Illia,
Can you please elaborate more on your suggestion:
"Also, note that double-clicking the cell with an expand icon should be used to expand the clicked member".
Also, can you provide an example how we can do this through context menu?
Please note, in our case right click doesn't launch the menu to clear sorting.
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 18, 2021

Hello,
 
Clicking on the cell with expand/collapse icon leads to expanding/collapsing the corresponding member. Therefore, using double click to clear sorting, in this case, will also cause expanding/collapsing the clicked cell. This behavior is ambiguous and should be avoided.
Instead, use the context menu to clear sorting. By default, it is opened after right-clicking on the cell. If the menu is not opened in your case for some reason, provide the example where the issue would be reproducible.
 
Regards,
Illia

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 15, 2021


Hello,
 
We are glad to inform you that the issue with clearing the sorting on grand totals was fixed.
Now, you can also use the workaround with a double-click to clear sorting for any member. Here is a JSFiddle for reference: https://jsfiddle.net/flexmonster/u6x3osw5/.
 
This is available in the 2.9.1 version of Flexmonster: https://www.flexmonster.com/release-notes/.
You are welcome to update the component. Here is our updating to the latest version tutorial for guidance: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Please let us know if everything works fine for you.
 
Best Regards,
Illia

Please login or Register to Submit Answer