Hello,
I have kendo window that pops up at the click of a link as shown below. Inside the window I have an input box which when changed gets data from the server
and displays the same on the kendo grid. The problem is, once I close the which and I re-open it, the previous data still shows. How can I clear the
currently loaded data on the close of the Kendo window?
Below is my Home/Index.vbhtml and Application/Index.vbhtml (which opens in a window as a partial view)
Regards.
Home/Index.vbhtml
<a href="#" onclick='openWindow()'>Open Window</a>
<div id="Window">@Html.Partial("~/Views/Application/Index.vbhtml")</div>
<script>
function openWindow() {
$("#Window").kendoWindow({
actions: ["Close"],
width: 1290,
height: 580,
modal: true,
title: "Loan Application",
visible: false
}).data("kendoWindow").center();
$("#Window").data("kendoWindow").open();
};
</script>
Application/Index.vbhtml
<input autocomplete="off" id="TxtUserID" />
<div id="grid"></div>
<script>
$(function () {
$('#TxtUserID').change(function () {
LoanDataGrid()
})
});
</script>
<script>
function LoanDataGrid() {
var UserID = $("#TxtUserID").val();
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
data: { UserID: UserID },
dataType: "json",
url: '@Url.Action("Grid", "Application")',
}
},
schema: {
model: {
fields: {
Id: { type: "string" },
Name: { type: "string" },
Age: { type: "string" }
}
}
},
pageSize: 1
},
toolbar: ["search"],
height: 205,
scrollable: true,
persistSelection: true,
columns: [
{ field: "Id", title: "Id", width: "50px" },
{ field: "Name", title: "Name" },
{ field: "Age", title: "Age" },
]
});
};
</script>
I have kendo window that pops up at the click of a link as shown below. Inside the window I have an input box which when changed gets data from the server
and displays the same on the kendo grid. The problem is, once I close the which and I re-open it, the previous data still shows. How can I clear the
currently loaded data on the close of the Kendo window?
Below is my Home/Index.vbhtml and Application/Index.vbhtml (which opens in a window as a partial view)
Regards.
Home/Index.vbhtml
<a href="#" onclick='openWindow()'>Open Window</a>
<div id="Window">@Html.Partial("~/Views/Application/Index.vbhtml")</div>
<script>
function openWindow() {
$("#Window").kendoWindow({
actions: ["Close"],
width: 1290,
height: 580,
modal: true,
title: "Loan Application",
visible: false
}).data("kendoWindow").center();
$("#Window").data("kendoWindow").open();
};
</script>
Application/Index.vbhtml
<input autocomplete="off" id="TxtUserID" />
<div id="grid"></div>
<script>
$(function () {
$('#TxtUserID').change(function () {
LoanDataGrid()
})
});
</script>
<script>
function LoanDataGrid() {
var UserID = $("#TxtUserID").val();
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
data: { UserID: UserID },
dataType: "json",
url: '@Url.Action("Grid", "Application")',
}
},
schema: {
model: {
fields: {
Id: { type: "string" },
Name: { type: "string" },
Age: { type: "string" }
}
}
},
pageSize: 1
},
toolbar: ["search"],
height: 205,
scrollable: true,
persistSelection: true,
columns: [
{ field: "Id", title: "Id", width: "50px" },
{ field: "Name", title: "Name" },
{ field: "Age", title: "Age" },
]
});
};
</script>