我试图在点击链接时弹出一个kendo网格。 Kendo grid在弹出窗口中完美打开,但过滤和排序功能无法正常工作。我正在使用服务器端操作。当我在DatasourceRequest中对控制器端的特定列进行排序时,我总是将值变为null。
非常感谢任何帮助。
<div class="panel-body" id="countryImageData">
@(Html.Kendo().Grid(Model.GlobalInventoryImages)
.Name("InventoryCountryImageDetailsGrid")
.Columns(columns =>
{
columns.Bound(p => p.SmartInventoryID).Hidden().Title("SPC #").HtmlAttributes(new { @id = "CountrySmartInventory_Grid" });
columns.Bound(p => p.SubwayProductCode).Width(50).Title("SPC #").HtmlAttributes(new { @id = "CountrySubwayProductCode_Grid" });
columns.Bound(p => p.GlobalCaseImageName).Width(100).Title("Case Images").HtmlAttributes(new { @id = "GlobalCaseGraphicName_Grid" }).ClientTemplate(" <a href=\"javascript:void(0);\" class=\"btn-openpdf\" onClick = \"getGlobalImage(this,false,true,true);\">#=GlobalCaseImageName#</a> ");
columns.Bound(p => p.GlobalInnerImageName).Width(100).Title("Inner Images ").HtmlAttributes(new { @id = "GlobalInnerImageName_Grid" }).ClientTemplate(" <a href=\"javascript:void(0);\" class=\"btn-openpdf\" onClick = \"getGlobalImage(this,false,false,true);\">#=GlobalInnerImageName#</a> ");
columns.Bound(p => p.CountryNames).Width(100).Title("Country").HtmlAttributes(new { @id = "CountryNames_Grid" });
})
.Pageable(pager => pager.PageSizes(new int[] { 25, 50, 75, 100 }).Input(true))
.Sortable(e => e.AllowUnsort(true).SortMode(GridSortMode.MultipleColumn))
.Scrollable()
.ColumnMenu()
.NoRecords("No Records")
.Selectable(e => e.Mode(GridSelectionMode.Multiple))
.Filterable()
.ColumnResizeHandleWidth(10)
.ColumnResizeHandleWidth(10)
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.HtmlAttributes(new { @class = "custom-kendo-grid custom-kendo-grid-inv" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.PageSize(25)
.Read(read => read.Action("InventoryImage_Read", "Inventory").Data("function onCountryAdditonalData(){ return {subwayProductCode: $('#SubwayProductCode').val()};}"))
)
)
</div>
答案 0 :(得分:0)
使用MVC,您必须在dataSource中添加以下内容:
type: 'aspnetmvc-ajax'
用于过滤器并排序不为null。此外,MVC Controller中的Action方法必须设置如下参数:
public async Task<ActionResult> InventoryImage_Read([DataSourceRequest] DataSourceRequest )
您没有发布MVC控制器操作,所以我不确定您是否正确设置了该部分。我希望这会有所帮助。