Page 1 of 1
[ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Fri Jan 21, 2022 3:48 pm
by abisht
Hi,
I am trying to add remote filtering in edit cell combo type editor.
I have the following store config:
public employeeStore: AjaxStore = new AjaxStore({
data: [],
filterParamName: 'firstName',
readUrl: '/api/v1/driver/getDriverListForDropDown',
sendAsFormData: true
});
Even though I have defined sendAsFormData as true, still my filter request is going as query param.
Angular 8
Bryntum : 3.0.3
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 10:22 am
by alex.l
There is a difference via request params and form data (payload). filter - is a part of params that will be send in request params format depends on an HTML method used (GET/POST, etc).
sendAsFormData
applies on request body only (payload).
But thank you for a question, we found a bug with our request formatting, here is a ticket: https://github.com/bryntum/support/issues/4058
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 10:45 am
by abisht
So for CREATE/UDPDATE, form data is applicable ? For GET, it will always be query param right ?
I have one more issue to point out.
The query param generated is not properly encoded :
[{%22field%22:%22DriverCode%22,%22operator%22:%22startsWith%22,%22value%22:%221%22,%22caseSensitive%22:false}]
ideally
should be encoded
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 10:49 am
by alex.l
There is https://bryntum.com/docs/gantt/api/Core/data/AjaxStore#function-encodeFilterParams method that allows you to play a bit with formatting.
By default is looks like
encodeFilterParams(filters) {
const
result = [];
for (const { property, operator, value, caseSensitive } of filters) {
result.push({
field : property,
operator,
value,
caseSensitive
});
}
return JSON.stringify(result);
}
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 10:52 am
by abisht
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 11:37 am
by alex.l
And I've opened a ticket to fix that moment https://github.com/bryntum/support/issues/4059
Thank you for the report!
Re: [ANGULAR] parameter sendAsFormData is not sending data as form
Posted: Mon Jan 24, 2022 11:43 am
by abisht