Change grid sort in Kinetic dashboard?

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.

Is there a hidden event in there somewhere?

Thanks,

Joe

Is there a reason you aren’t sorting it at the BAQ level?

1 Like

Yeah that was my first thought. If you’re looking for the initial sort, just save the BAQ sorted.

Yes, the BAQ is used in a number of other dashboards and it would affect them all. I just need this one sorted differently.

Thanks,

Joe

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.

Ah, well. Thanks.

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.

4 Likes

Nice. Thanks, Kevin.

1 Like

Not really an amazing solution but it could work:

  • 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.

I tend to do that, but instead of concatenating the data, I use

row_number() over ( partition by field.SomeFieldInAllTheRows order by field.sort1, field.sort2 etc)

That way it’s just row numbers and is less confusing to the users why it’s there. Usually a field like company so everything is in the partition.

2 Likes