Change sort/filter url request param

Hello,

I have got a problem to sorting datatable, how to handle url param like sort [colomname]=desc, I couldn’t find yet request with spring MVC, is possible change webix url sorting onAfterFilter or onAfterSort


http://mydomain/api/v1/phone?start=0&count=50&continue=true&sort[col_name]=asc 

–become →


http://mydomain/api/v1/phone?start=0&count=50&continue=true&sort=col_name&col_name.dir=desc

http://webix.com/snippet/d25e858a

I follow refer this way to handle sorting: http://docs.spring.io/spring-data/rest/docs/2.0.0.M1/reference/html/paging-chapter.html

Best regards,
Fin

do not know about events, but you can create custom proxy, where can change url params

Thanks Intregal, I try using proxy
I use this http://webix.com/blog/dynamic-loading-fetching-unlimited-number-of-records-from-server-side/

How to add more param filtering with square bracket
http://webix.com/snippet/f5259eec

try this proxy:

    webix.proxy.spring = {
        $proxy: true,
        load: function (view, callback, params) {
            if (params) {
                var sort = params.sort;
                delete params.sort;
                if (sort) {
                    params.sort = sort.id;
                    params[sort.id + '.dir'] = sort.dir;
                }
                arguments[2] = params; //not necessary
            }
            return webix.proxy.post.load.apply(this, arguments);
        }
    };

and set url as ‘spring->your_url’

The proxy doesnt work
I got an error: Cannot read property ‘load’ of undefined
I try to change return to webix.ajax(this.source, callback, view); all same

are you sure? it works for me. error is possible if you somehow delete webix.proxy.post

you can change the last row to this one

webix.ajax().bind(view).post(this.source, params, callback);

Yes, working! thanks a lot Intregal :slight_smile: