在使用下面的 JavaScript 过滤数据后,我试图通过单击按钮重新绑定 Kendo Grid,但它不起作用。我应该怎么办?
我使用 Kendo.Mvc.Dll 的 HTML 代码:
Html.Kendo().Grid<EquityStreet.Data.ESData.Proc_GetESManagersListAndFilterResult>().Name("GridESManager").BindTo(Model.ESManagersList).Columns(columns =>
{
columns.Bound(m => m.pkESManagerId).Template(@<input type="checkbox" id="@item.pkESManagerId" />).Title("").Width("2%");
columns.Bound(m => m.pkESManagerId).Template(@<text> @item.FirstName @item.LastName</text>).Title("Name");
columns.Bound(m => m.CompanyName).Title("Company");
columns.Bound(m => m.MobileNo).Title("Phone Number");
columns.Bound(m => m.ESManagerStatus).Template(@<text>@(item.ESManagerStatus == 1 ? "Active" : "Inactive")</text>).Title("Status");
columns.Bound(m => m.pkESManagerId).Template(@<text> <a href="../Utilities/NewESManager?EId=@item.pkESManagerId" class="access_btn">
</a><a href="../Utilities/NewESManager?EId=@item.pkESManagerId" class="notes_btn"></a><a href="../Utilities/NewESManager?EId=@item.pkESManagerId" class="edit_btn">
</a><a href="../Utilities/NewESManager?EId=@item.pkESManagerId" class="delete_btn"></a>
</text>).Title("Actions");
}).ToolBar(tb =>
{
tb.Template("<div class='GridSearchHeader'><div style='float:left'><input type='button' value='Reset Pwd'><input type='button' value='Delete'></div><label>Filter: </label><input type='search' style='width: 230px' id='txtSearch'><select id='Status'><option value=-1>Select</option><option value=1>Active</option><option value=0>Inactive</option></select><input type='button' onclick='FilterList()' value='Go'><input type='button' value='Reset'></div>");
}).Pageable()
)
JavaScript:
$.post('@Url.Action("FilterESManagerList", "../../Utilities")', { Keyword: Search, UserStatus: status }, function (result) {
var grid = $("#GridESManager").data("kendoGrid");
grid.dataSource.data(result);
grid.refresh();
alert(grid);
});