[英]reload kendo after search mvc
Heello, Kendo grid cannot reload results after search .I'm posting results with code below. Heello,Kendo网格搜索后无法重新加载结果。我将使用以下代码发布结果。 After that nothing is happend.What is wrong here.Thanks 之后什么也没发生,这是怎么回事。
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "invoice-form" }))
{
to controller and script which is calling on btnSearch 到正在调用btnSearch的控制器和脚本
<script>
$(function() {
$("a.saveInvoicePopup").on('click', function (e) {
debugger;
e.preventDefault();
var dataObj = serializeByFieldsWrap(".invoiceForm");
var dataUrl = $(this).data('url');
// dataObj.ToolboxId = toolboxId;
$('body').css('cursor', 'wait');
var result = $.ajax({
type: "POST",
url: dataUrl,
dataType: 'json',
data: dataObj
});
result.done(function (data) {
console.log(data);
if (data.Success) {
var grid = $('#invoices-grid').data("kendoGrid");
grid.dataSource.data(result);
grid.refresh();
}
});
result.fail(function (error) {
console.log(error);
});
});
});
</script>
In the line below, replace result
with the actual variable that holds the received data: 在下面的行中, 将 result
替换为包含已接收数据的实际变量:
grid.dataSource.data(result);
In your code, result
is the jqXHR object, not the actual response . 在您的代码中, result
是jqXHR对象,而不是实际的response 。
Also, remove refresh()
, as it is not needed: 另外, 删除 refresh()
,因为它不需要:
grid.refresh();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.