Our blazing fast Grid component built with pure JavaScript


Post by jason song »

Hi Bryntum,

I am successful tested in Schduler module, to override ajax sendRequest:

crudManager:{
                    autoLoad:true,
                    autoSync:true,
                    loadUrl:'loadData',
                    syncUrl:'syncData',
                    async sendRequest(config){ ...}
}

but applied to grid, it's not in work. I installed a store:

store:{
                autoLoad:true,
                createUrl : 'createData',
                readUrl   : 'readData',
                updateUrl : 'updateData',
                deleteUrl : 'deleteData',
              }

then it invoke the url /readData directly, but I need it via my sendRequest.

Please help how could I retrieve the similar result like from Scheduler.

Thank you


Post by tasnim »

Hi,

For Grid, you could use this event https://bryntum.com/products/scheduler/docs/api/Core/data/AjaxStore#event-beforeRequest
Through this, you can manipulate the request before sending it

store : {
	listeners : {
		beforeRequest(props) {
			props.params.team = 'Bryntum'
		}
	}
}

Hope it helps.

Best regards,
Tasnim


Post by jason song »

Thank you the listeners could help me pass more parameters but I am running in a iframe, I need post the request to be handled from iframe.parent so I need a take over to crudManger.sendRequest.
I did it for Schedule well. Now need the similar way for grid. Please try understand my case..


Post by marcio »

Hey jason,

What parameters are you trying to change? Could you provide more context on that?

The beforeRequest listener that Tasmin suggested will allow you to edit the request similar to the sendRequest function, what parameter are you not being able to change with that?

Best regards,
Márcio


Post by jason song »

I want intercept your Ajax request and use my Ajax call. Like the way in scheduler crudManager, I can override sendRequest.


Post by ghulam.ghous »

Hi there,

If I understood correctly, you want to override the sendLoadRequest in the AjaxStore. This method is being used to send request to load data from the readUrl. But this method is internal and called from another private method internalLoad. load method https://bryntum.com/products/grid/docs/api/Core/data/AjaxStore#function-load calls the internalLoad method if pagination is not used. You can review the code in the AjaxStore class and make changes accordingly. You can play around with this our php backend demo here http://lh/bryntum-suite-release/Grid/examples/php-paged/. Hope this addresses your concerns.

Regards,
Ghous


Post Reply