Our pure JavaScript Scheduler component


Post by hlabatf@colas.com »

Hello,

I'm wondering how to export only filtered data from eventStore and ResourceStore.

I'm doing this:

        payload.events = this._eventStore.query((record: any) => record.isAvailable == true).map(event => event.toJSON()) ?? [];

    payload.resources = this.prepareResourceData(this._resourceStore.query((record: any) => record.isAvailable == true).map(resource => resource.toJSON()) ?? []);

But it's not working with tree.

Best regards,

François


Post by marcio »

Hey François,

Thanks for reaching out.

To export only filtered data from a tree structure, you need to ensure that you're correctly handling the tree nodes. The query method should work for filtering, but you might need to adjust how you handle tree data. If your stores are configured as tree stores, you can use the getChildren method to retrieve children of a node and filter accordingly.

Ensure that your tree nodes are correctly expanded or collapsed based on your filtering logic. If you need to handle tree-specific logic, consider using methods like getChildren or traverseWhile to navigate through the tree structure.

If this doesn't resolve the issue, please provide more details about how your tree data is structured or any specific errors you're encountering.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by hlabatf@colas.com »

Thanks, i will take a look. Filters are applied and work well visually.
I was looking where filtered data where stored. I found this:

this._resourceStore.allResourceRecords

WHat do you think about it?


Post by ghulam.ghous »

You mean all the data? If you want to get all the data, you can use allRecords prop on the resourceStore: https://bryntum.com/products/scheduler/docs/api/Scheduler/data/ResourceStore#property-allRecords


Post by hlabatf@colas.com »

No, i mean all filtered data.

I need to find a simple way to extract filtered data from Bryntum SCheduler component.


Post by marcio »

Hey François,

To extract only the filtered data from the Bryntum Scheduler component, you can use the query method on your store, as you have done. This method will return only the records that match your filter criteria. If your data is structured as a tree, ensure that you are correctly handling the hierarchical data. You might need to recursively check each node and its children to ensure that the entire tree structure is considered in your filtering logic.

You can try to navigate through all nodes using https://bryntum.com/products/scheduler/docs/api/Core/data/Store#function-traverse and then manually filter to a custom array.

If you are still facing issues, please provide more details or a code snippet of how your data is structured, so we can assist you further.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post Reply