I’m trying to use webix with some none standard backend, so I need proxy object. But I’m not quite sure what is the right way.
I read http://docs.webix.com/desktop__server_proxy.html
there is sample code:
load:function(view, callback, details){
console.log(details);
if (details){
var data = [];
for (var i=0; i<details.count; i++)
data.push("x"+(i+1+details.from));
webix.delay(function(){
webix.ajax.$callback(view, callback, {
pos:details.from,
data:data
});
});
} else {
webix.ajax.$callback(view, callback, {
total_count:100,
data:["1","2","3","4","5"]
});
}
}
This code uses webix.ajax.$callback that’s not even from official documentation.
And I can’t find anywhere what parameters (and in what case) could save and load functions have
Can you please format code properly? Just prefix each line with four spaces. It’s easiest if you do this in your editor by selecting the text and pressing Tab before pasting it here.
Oh, yes I see, one more “tab” for the whole code block helped. I updated my other post, this one however is locked, I think forum gives only 24 hours for changing
I couldn’t agree more. Webix Proxy objects defenitely need much better documentation. Parsing data returned from a backend (e.g. from a spring rest API) is a very common task.
Some things I found out so far:
the proxy.load method can get a third parameter when using dynamic loading and paging.
the proxy.load method can return a plain array of rows for a datatable.
but when you use paging you must return the total_count for the pager to work => I am still trying to figour out how exactly…
And there are also webix DataDrivers which seem to be related…