Hello,
I am using a listview with a data manager like this:
<ejs-listview id="idList" cssClass="e-list-template m-2" showHeader="false"
template="#listTemplate"
actionComplete="onListComplete">
<e-data-manager url=" /Quarter/ListItems" adaptor="UrlAdaptor">
</e-data-manager>
</ejs-listview>
I want to refresh the listview items after a UI change. For that, I call a javascript function (a piece of code I have found in your documentation):
function switchChange() {
const grid = document.getElementById("idList").ej2_instances[0];
const ajax = new ej.base.Ajax('/Quarter/ListItems', 'GET');
ajax.send();
ajax.onSuccess = function (data) {
grid.dataSource = ej.data.DataUtil.parse.parseJson(data).result;
};
}
It calls the Controller method and send back the data, but doesn't refresh the listview.
How can I simply refresh the listview with updated remote data without reloading the page?
In fact, I have the same question for the diagram and the kanban component.
Thank you Sharon,
I manage to work it out with you sample, but I have still some issues.
As a reminder, my need is to refresh a listview / a diagram / a kanban with updated remote data without reloading the page, not after CRUD actions but after filtering actions.
function actionComplete (args) {
if (args.result.length === 0) {
$("#noItemList").show();
}
}
When I load the updated data, I have a problem on args.result.length, and I don't know why. (It works when loading the initial data.)
Many thanks for your support,
Regards,
Laurent
|
function refershDiag() {
// make any change the service.
var diagram = document.getElementById("diagram").ej2_instances[0];
diagram.refresh();
}
|
Thanks for the reply, it helps.
There is a last point because we misundertsood each others: I don't find how to manage the listview groupby and the kanban swimlane in javascript. I know how to do it in the aspnet. I want to set and unset listview groupby and the kanban swimlane in a javascript function.
Best regards,
Laurent
|
function onButtonClick() {
$.ajax({
url: '/ListView/ReceiveData',
type: 'POST',
dataType: 'json',
success: function (result) {
var list = document.getElementById("userList").ej2_instances[0];
list.dataSource = result;
list.fields.groupBy = "RoleCategory";
}
})
} |
|
function onButtonClick() {
kanbanObj.swimlaneSettings.keyField = 'Assignee';
}
|
Perfect!
Thanks for your reply.
Regards,