I cannot provide a working example, but I will try and explain in as much detail as possible.
My datatable and pager set up is as follows:
{
view: "datatable",
height: 0,
width: 0,
select: "row",
hover: "hover",
css: "webix_data_border",
datafetch: 50,
pager: "myPager",
tooltip: true,
columns: [
{
id: "col1",
header: ["Col1"],
sort: "server",
adjust: true
},
{
id: "col2",
header: ["Col2", { content: "serverFilter" }],
sort: "server",
adjust: true
}
]
{
view: "pager",
id: "myPager",
template:`{common.first()} {common.prev()} {common.pages()} {common.next()} {common.last()}`,
size: 50,
group: 5,
height: 40,
width: 0,
animate: {
direction: "top"
}
}
I need to implement dynamic loading for this datatable, 50 records at a time, inside the .load method of the datatable (NOT using the url parameter in datatable constructor).
The response structure of the API call is of the form:
"data": [{}, {}, {}],
"total_count": 1200,
"pos": 0
Initially, I was using a GET method, and the following worked as expected, including dynamic loading with pagination:
url = "my_endpoint?param1=xyz¶m2=abc"
datatable.load(url)
.then((data) => {
let id = datatable.getFirstId();
datatable.select(id);
})
.fail((error) => {
webix.message({
text: error.message || "Error loading data",
type: "error",
expire: 2000
});
});
Now, I need to switch to a POST method. So I modified my code as follows:
let response = this.http.post(url, body);
response.subscribe({
next: data => {
datatable.parse(data);
},
error: error => {
console.log("Error loading data");
}
});
datatable.parse(data)
populates my datatable, but pagination does not trigger dynamic loading.
Is there a workaround for this? Thanks in advance.