Server side CORS and additional params

Looking at the trial version.

There is a lot to absorb, it is looking good so far.

I have been using ExtDirect, so I have my server side in place. My challenge is to replace the client side with webix.

It is not clear to me where I need to accomplish CORS. I am just guessing (and guessing wrong).

`
webix.ready(function(){
grida = webix.ui({
container:“testA”,
view:“datatable”,
columns:[
{ id:“id”, header:"#", width:50, sort:“int”},
{ id:“title”, header:“Film title”,width:200, sort:“string”},
{ id:“user_id”, header:“uid” , width:80, sort:“int”},
],
autowidth:true,
pager:{
container:“pagingA_here”,
size:50,
group:5
},
//data:big_film_set,
url:“v1.php”
});
webix.attachEvent(“onBeforeAjax”, function(mode, url, data, request, headers){
request.setRequestHeader(“Origin”,“http://my.site.dev”);
});

`
That loads the first page, subsequent pages die with “The object’s state must be OPENED.”
Anyways, I am not going to want every singlwe ajax call to be CORS.

I’m also not clear on how the additional browse parameters are sent (sort, filters).

Right now I have used the JSONDataConnector from DHX to see my data in a grid.
I see DHX sending data in the same format I already have: {data[…], “pos”:… “total”:…}
But how do I know what properties are legal/expected?

I searched all the samples for “onBeforeAjax”. What have I missed?
Which doc pages tell me how to intercept/add/digest/interpret/build the additional parameters sent and received?
Thank you.

Check the “proxy” objects

http://docs.webix.com/desktop__server_proxy.html#creatingcustomproxyobjects

You can define a custom data loader that will use ajax with all necessary headers and extra parameters.

webix.proxy.withHeaders = {
    $proxy:true,
    load:function(view, callback){
       webix.ajax().headers({
          "Origin" : "my.site.dev"
        }).get(this.source, callback, view);
    }
};

and later

url:"withHeaders->v1.php"

Thank you.
I do not think browsers will allow us to set ‘Origin’.
When I try your code I see "webix_debug.js:2470 Refused to set unsafe header “Origin” in the console.
Trying to figure out what extJS did, looks like they used “withCredentials”, but I am having no success there either.

It needs more time from me to be certain.