Premium support for our pure JavaScript UI components


Post 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.

https://localhost:4200/api/v1/driver/getDriverListForDropDown?firstName=[{%22field%22:%22DriverCode%22,%22operator%22:%22startsWith%22,%22value%22:%221%22,%22caseSensitive%22:false}]

Angular 8
Bryntum : 3.0.3


Post 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

All the best,
Alex


Post 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


Post 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);
}

All the best,
Alex


Post by abisht »

oh ok..thank you.


Post 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!

All the best,
Alex


Post by abisht »

Thank you.


Post Reply