I’m trying to resort the rows in a grid after the dataview has been loaded from the BAQ.
I can make it sort with the grid-sort-set widget, but I’m having a heck of a time figuring out where to fire it. The dataview events list only row and view changed and changing. It doesn’t fire here.
I can put it on an after-refresh event, but that doesn’t run initially, so the first sort doesn’t happen.
That’s a bummer. I’m sure it skips the custom sort because they (epicor developers) are assuming that it will be sorted from the BAQ on the first retrieval, and only need the reset after the user has messed with the grid.
I wish I could help, but I’m uselessly ignorant of app studio at this point.
Hey I was thinking about this over the weekend and I think I have a solution for you, if you’re still looking:
You can get it to sort when it initially loads by firing on the DataView > Row Changed hook. That gets the sort done when the dashboard is opened, but it would fire every time a row is changed, which isn’t super helpful. To get around that, I put a condition in front of the sort: "{CallContextBpmData.Checkbox10}" === "true"
When the form loads, the checkbox will be false, so it will sort by the column you specify. After the sort, I use the row update event to set the CallContextBpmData.Checkbox10 to true before I exit the event. That way, the sort event only fires the very first time row-changed occurs, right after the grid is initially populated.
add a few calculated fields of type text in the BAQ like: sort_dashboard1, Sort_dashboard2 and so on;
the values on each one of these should be a concatenation of columns you want to sort for each dashboard with a separator in between (like dot, dash and so on);
on each dashboard add the column which has the sorting for that dashboard and click on the grid to gave data sorted on that column.
sort on the dashboard grid on that column by clicking on the column and then deploy the dashboard.
It would work well except if people want to copy data to excel you have one more useless column but it would solve the problem.