When I switch my webix.min.js
, as my previous question. I can not access _feed_last object to get last feed url in datatable, eg:
$$("tbl")._feed_last.url
and when I switch back to webix.js
its working well.
How can I access _feed_last.url in production mode (webix.min.js) ? any other replacement object to this
Hello finzaiko,
All methods in our webix.js source code that begin with an underscore are considered private (not for customization), and when minifying the code they are also obfuscated, mean that there will be some other shorter name in webix.min.js instead of _feed_last name .
That means that you will not be able to get access to this private object in the production mode.
Could you describe the problem and the reason why you need _feed_last object access and maybe we could help you find a stable solution?
I have a lazy loading datatable, only specific column (qty_book)
I need _feed_last.url to get last url has filtered or go to next page by user, then I replace the endpoint to faster endpoint.
How can I get same url as _feed_last.url in onAfterLoad event? can yo help me also working on production script mode appreciate it.
Thank you
{
view: "datatable",
id: prefix + "_table",
url:url: `${url}/endpoint_faster`,
...
onAfterLoad: function () {
this.hideOverlay();
const tbl = $$(prefix + "_table");
const lastUrlFeed = tbl._feed_last.url;
let newUrl = `${url}/endpoint_faster`;
if(typeof lastUrlFeed !="undefined"){
newUrl = lastUrlFeed.replace("/endpoint_slower?", "/data?");
}
webix.ajax(newUrl).then(function (res) {
let data = res.json().data;
setTimeout(() => {
const grid = $$(prefix + "_table");
for (var i = 0; i < data.length; i++) {
const item = grid.getItem(data[i].id);
if(typeof item !="undefined"){
grid.getItem(data[i].id).qty_book = data[i].qty_book;
}
}
grid.refreshColumns();
}, 1000);
});
},
}
Hello finzaiko,
To replace the url which the request is made to (including dynamic loading), you need to use either a proxy or url as a function, and in this function, before the request, select the URL depending on some of your conditions (but without using a private API).
If you want to preserve server-side sorting and filtering , then here is an example of a proxy, where all the logic for collecting parameters in the request is applied (but without changing request URL): Code Snippet
But there is one note about this example - the server ,which the example works with, implements only server-side filtering, and it will not respond to sorting. Here we just wanted to show the logic of preserving sorting and filtering functionality.