C# 根据元素列表的顺序对Kendo UI网格列重新排序
你好 我有一个包含元素的列表,根据该列表将获得网格。我需要更改列表中元素的顺序。因此,当我更改列表的顺序并运行报告时,网格是按照列表之前的顺序获得的,而不是按照新更改的顺序 名单如下:C# 根据元素列表的顺序对Kendo UI网格列重新排序,c#,jquery,kendo-asp.net-mvc,kendo-ui-grid,C#,Jquery,Kendo Asp.net Mvc,Kendo Ui Grid,你好 我有一个包含元素的列表,根据该列表将获得网格。我需要更改列表中元素的顺序。因此,当我更改列表的顺序并运行报告时,网格是按照列表之前的顺序获得的,而不是按照新更改的顺序 名单如下: @Html.ListBox("multiselect_to", Model.AvailableColumnsList, new { @class = "form-control bdr_rad_3", size = "8", multiple = "multiple" }) 以下是剑道格网代码: @(Html.
@Html.ListBox("multiselect_to", Model.AvailableColumnsList, new { @class = "form-control bdr_rad_3", size = "8", multiple = "multiple" })
以下是剑道格网代码:
@(Html.Kendo().Grid<Entrada.CustomerPortal.UI.Models.JobReport>()
.Name("JobReportGrid")
.ToolBar(tools => tools.Pdf())
.Pdf(pdf => pdf
.AllPages()
.FileName("Kendo UI Grid Export.pdf")
.ProxyURL(Url.Action("Excel_Export_Save", "JobReports")))
.ToolBar(tools => tools.Excel())
.Excel(excel => excel
.AllPages(true)
.FileName("Kendo UI Grid Export.xlsx")
.ProxyURL(Url.Action("Excel_Export_Save", "JobReports")))
.ColumnMenu()
.Columns(columns =>
{
columns.Bound(p => p.JobNumber)//.Title("Job <br/> Number")
.Width(colWidth["Job Number"])
.ClientTemplate("<a class='jobReportGridJN' jnum='#=JobNumber#'>" + "#=JobNumber#" + "</a>"+
@" #if(STAT== true) {# <span><img src='" + Url.Content("~/Images/stat-icon.png") + "'> </span>#}#");
columns.Bound(p => p.DictatorID);
columns.Bound(p => p.JobType);//.Title("Job <br/> Type");
columns.Bound(p => p.DeviceGenerated)//.Title("Device <br/> Generated")
.Width(colWidth["Device Generated"]);
columns.Bound(p => p.AppointmentDate)//.Title("Appointment <br/> Date")
.Width(colWidth["Appointment Date"])
.Format(colFormat["Appointment Date"]);
columns.Bound(p => p.InProcess)//.Title("In <br/> Process")
.Width(colWidth["In Process"])
.Format(colFormat["In Process"]);
columns.Bound(p => p.EditingComplete)
.Width(colWidth["Editing Complete"])
.Format(colFormat["Editing Complete"]);
columns.Bound(p => p.JobStatus);//.Title("Job <br/> Status");
columns.Bound(p => p.MRN);
columns.Bound(p => p.Patient);
})
.Groupable()
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single)
.Type(GridSelectionType.Row))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read
.Action("JobSearchPaginationGrid", "JobReports")
.Data("residentsReadData"))
.Events(events => events.Error("error_handler"))
.PageSize((int)ViewData["PageSize"])
.Group(group => group.Add<string>((string)TempData["GridGroupBy"]))
.ServerOperation(true)
)
.Pageable(pager => pager.Messages(Info => Info.Empty("No Results Found")))
.Sortable()
.Resizable(resize => resize.Columns(true))
.Scrollable().Selectable(s => s.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
)
@(Html.Kendo().Grid())
.Name(“JobReportGrid”)
.ToolBar(tools=>tools.Pdf())
.Pdf(Pdf=>Pdf
.AllPages()
.FileName(“Kendo UI Grid Export.pdf”)
.ProxyURL(Url.Action(“Excel\u导出\u保存”、“作业报告”))
.ToolBar(tools=>tools.Excel())
.Excel(Excel=>Excel
.AllPages(真)
.FileName(“Kendo UI Grid Export.xlsx”)
.ProxyURL(Url.Action(“Excel\u导出\u保存”、“作业报告”))
.column菜单()
.列(列=>
{
columns.Bound(p=>p.JobNumber)/.Title(“作业
编号”)
.Width(colWidth[“作业编号”])
.ClientTemplate(“
那么,在更改列表的顺序后,我可以基于该列表元素对网格列重新排序吗
如果有人能迅速回答,那会更有帮助
谢谢
Sai我自己也没有尝试过,但在谷歌搜索一分钟后,如果我理解正确,实现这一目标的过程似乎包括两个步骤:
首先,必须将网格的reorderable设置为true
.Reorderable(reorder=>reorder.Columns(true))
在列表更改事件中以编程方式重新排列列:
var grid=$(“#JobReportGrid”).data(“kendoGrid”);
grid.reorderColumn(newOrderIndex,grid.columns[currentIndex])
我自己还没有尝试过,但在谷歌搜索一分钟后,如果我理解正确,实现这一目标的过程似乎包括两个步骤:
首先,必须将网格的reorderable设置为true
.Reorderable(reorder=>reorder.Columns(true))
在列表更改事件中以编程方式重新排列列:
var grid=$(“#JobReportGrid”).data(“kendoGrid”);
grid.reorderColumn(newOrderIndex,grid.columns[currentIndex])
我认为这会有帮助。我认为这是关于对剑道网格数据进行分组。我的要求不是对网格数据进行分组。谢谢。我认为这会有帮助。我认为这是关于对剑道网格数据进行分组。我的要求不是对网格数据进行分组。谢谢