Premium support for our pure JavaScript UI components


Post by vasyl obukh »

Hi,
Could you please help with an issue I faced when making filters stateful using local StateProvider in the ResourceUtilization?

I have such a configuration for ResourceUtilization:

    stateId: "resource-utilization",
    stateful: ["filters"],
    stateProvider: StateProvider.setup("local"),

This was enough to make filters autosave in local storage for SchedulerPro and ResourceHistogram (we have a select component to switch between different diagrams). But it doesn't work in ResourceUtilization.
You can watch it in the attached video and also check yourself using the attached code example.

You can use this code to add filters to the resource utilization component via the dev tools console:

bryntum.get("b-resourceutilization-1").filter({ property: "name", operator: "=", value: "Celia" });

Do I need to configure it somewhat differently from other diagrams or is it a bug?

Attachments
Screen-Recording-2024-03-01-at-12.33.29 PM.mp4
(1.03 MiB) Downloaded 55 times
resourceutilization.zip
(204.49 KiB) Downloaded 51 times

Post by alex.l »

Hi,

Please use

resourceUtilization.store.filter(yourFilter)

All the best,
Alex


Post by vasyl obukh »

Hi Alex,
Thank you! Now it saves filters.
But now I have another issue because of the fact that resource utilization doesn't filter on resourceStore but on it's own store.
We have a page with a Gantt diagram at the top half of the screen and the bottom half is either SchedulerPro, ResourceHistogram, or ResourceUtilization (we have a select component to switch between them). And we want to keep filters consistent when switching between them. To do that we additionally use the same stateId.
I was thinking that resource utilization also filters on project.resourceStore as SchedulerPro and ResourceHistogram (it works well and keeps filters when switching between these two). But if it filters on resourceUtilization.store is there a way to still keep diagram filters in sync and save them properly in local storage?


Post by alex.l »

Hi, try to filter original store and keep that state in Gantt's config, it will be consistent. I guess that's the only easy way to achieve that, because it uses own store (to make a structure of data)

All the best,
Alex


Post by vasyl obukh »

Doesn't seem to work quite as I need, but anyway, due to some other requirements I need to save filters outside of Bryntum local storage entry. Is there a way to exclude store filters from local StateProvider (as they are saved even without putting filters into the stateful array)? Because it interferes with custom saving


Post by alex.l »

You could edit state object that you save into localStorage.
It's not configurable on other levels. You could review StoreState.js for private method getState and override it for your store, but I would recommend to edit state object.

All the best,
Alex


Post Reply