Page 1 of 1

[REACT] read Url of store

Posted: Thu Oct 06, 2022 7:34 am
by md shazeb

I am using Bryntum grid currently and were implementing various features so for that i am using store which has a readUrl property which expects a url and then it will make a call to the server.
The one thing i noticed that the call which it is making is a fetch call . So is there any way we can make it a Axios call.

Please help me with this ?


Re: [REACT] read Url of store

Posted: Thu Oct 06, 2022 8:19 am
by tasnim

Hi,
You can try override AjaxHelper.fetch method

AjaxHelper.fetch = function () { ... }

Make your own function that would use axios

And alternatively you can listen to beforeLoad event and start your own request from the listener and return false to prevent the default one

listeners : {
	beforeLoad() {
		// make your call with axios
		
	// return false to prevent the default fetch call
	return false;
}
}

Docs :
https://bryntum.com/docs/grid/api/Core/helper/AjaxHelper#function-fetch-static
https://bryntum.com/docs/grid/api/Core/data/AjaxStore#event-beforeLoad


Re: [REACT] read Url of store

Posted: Fri Oct 07, 2022 7:36 am
by md shazeb

I used beforeLoad listener and made Axios call but the data generated from it was not updated in the grid . So do i need to use read url when i am making a call inside the listener or data fetched from the call needs to be assigned to data property of config.

Please guide me to this ?


Re: [REACT] read Url of store

Posted: Fri Oct 07, 2022 7:59 am
by md shazeb

there is also one confusion that i need to make request both in Ajaxhelper.fetch and also in before Load Listener i need to. make request can you please provide an example with some dummy url.


Re: [REACT] read Url of store

Posted: Fri Oct 07, 2022 4:24 pm
by marcio

Hey md shazeb,

How did you assign that data to your Grid after you made the Axios call?? Could you please share that piece of code??

What do you mean by making both requests with AjaxHelper.fetch and beforeLoad listener?? I didn't get what you mean by that.