Premium support for our pure JavaScript UI components


Post by liuyan@honeycombtech »

Hi team,
How to update all resources or update partial resources, then get the raw resource data
I use 'this.scheduler.resourceStore.data=' and 'Object.assgin(this.scheduler, {resources})', but can't get raw resource data as same as scheduler show.
'this.scheduler.resourceStore.data' cannot update.
'records' always new

We alreay try many methods, such as "loadDataAsync", "add","removeAll", they all doesn't work.

They all 'records' are updated but 'data' is old.

We try to set 'useRawData' as true, and it also don't work.

11.jpg
11.jpg (179.21 KiB) Viewed 1363 times
22.jpg
22.jpg (220.27 KiB) Viewed 1361 times
    init() {
      this.scheduler = this.$refs.scheduler.instance;
    },
    getAllResouces() {
      // How to get raw data as same as scheduler show
      console.log(this.scheduler.resourceStore.data)
    },
    updateAllResources() {
      // Previously has 10 data and id and name is different 
      // Now update
      this.scheduler.resourceStore.data = [
        { id: "1", name: "Mike2" },
        { id: "2", name: "Linda2" },
        { id: "3", name: "Amit2" },
        { id: "4", name: "Angelo2" },
        { id: "5", name: "Emilia2" },
        { id: "6", name: "Gloria2" },
        { id: "7", name: "Hitomi2" },
        { id: "8", name: "Lisa2" },
      ]
      console.log(this.scheduler.resourceStore.data) //  before has 10 count, but now the same
    },
    updateOneResource() {
	// we want to update raw data to update instead of 'records' to update. Because we want to need raw data as same as record show. 
    }

Many thanks,


Post by alex.l »

Could you please attach a runnable test case since I don't see this problem in our examples using 5.0.1

All the best,
Alex


Post by liuyan@honeycombtech »

Hi team,

Here is demo in attachment, please check . Thank you

demo.zip
(140.88 KiB) Downloaded 72 times

Post by liuyan@honeycombtech »

Hi,
I have posted you a picture about this issue.

11.jpg
11.jpg (444.71 KiB) Viewed 1332 times

Have a nice weekend

Best regards.


Post by alex.l »

Thank you for the test case, seems like it is reproducible only using Vue. Here is a ticket: https://github.com/bryntum/support/issues/4481

All the best,
Alex


Post by liuyan@honeycombtech »

Hi,
When will this question probably be fixed?
We are block now.
Is there has a temp workaround?


Post by johan.isaksson »

Hi,

I think there is some misunderstanding here, I'll try to clarify and hopefully it will work out for you. Setting store.data turns the passed JSON into records. Accessing store.data later points to the original raw data, it wont be updated when records are added or removed etc. So most likely you do not want to use store.data after plugging data in.

If you want the raw data for the current state of the store, you should instead use store.json (gets you a JSON string) or store.toJSON() (gets you an array of JSON objects).

Give it a try and see if it is what you need?

Best regards,
Johan Isaksson

Post by liuyan@honeycombtech »

Hi johan.isaksson,

Thank you very very much. I moved to cry, it works.

Now I ask for help for what is the really right way to update all of the resources/events data and partially update the resources/events data in Vue.

When partially updated, we expect it not to reload.

thanks


Post by alex.l »

You need to enable https://bryntum.com/docs/scheduler-pro/api/Core/data/mixin/StoreSync#config-syncDataOnLoad for stores

Configure with true to sync loaded data instead of replacing existing with a new dataset.

Did you see https://bryntum.com/docs/scheduler-pro/guide/SchedulerPro/integration/vue/data-binding ?

All the best,
Alex


Post by liuyan@honeycombtech »

Hi alex,

In our project, we use websocket to get data instead of http request. It seems to different.

What is the really right way to update all of the resources/events data and partially update the resources/events data in Vue when use websocket?


Post Reply