未调用DevExpress GridView s.GetSelectedFieldValues函数
本文关键字:GetSelectedFieldValues 函数 GridView 调用 DevExpress | 更新日期: 2023-09-27 17:59:01
我有一个DevExpress MVC GridView,我想在那里只在客户端处理SelectionChanged事件,并使用AJAX将任何发布连接到服务器。
我的GridView调用了我的SelectionChanged()
函数,但该函数中的代码s.GetSelectedFieldValues("MedicalRecordNumber", GetSelectedFieldValuesCallback);
似乎什么都没做,并且没有调用GetSelectedFieldValuesCallback(values)
。
这是我的GridView部分视图,它没有标记。。。
@model IEnumerable<CaseReview>
@Html.DevExpress().GridView(
settings =>
{
settings.Name = "workListTable";
settings.Width = Unit.Percentage(90);
settings.SettingsBehavior.AllowSort = true;
settings.Settings.ShowFilterRow = true;
settings.KeyFieldName = "UUID";
settings.Columns.Add(column =>
{
column.FieldName = "CaseReviewID";
column.Caption = "CaseReviewID";
column.CellStyle.CssClass = "devExCaseIdHidden";
});
settings.Columns.Add(column =>
{
column.FieldName = "FacilityName";
column.Caption = "FacilityName";
});
settings.Columns.Add(column =>
{
column.FieldName = "MedicalRecordNumber";
column.Caption = "Medical Record Number";
});
settings.Columns.Add(column =>
{
column.FieldName = "DateOfBirth";
column.Caption = "DateOrBirth";
});
settings.Columns.Add(column =>
{
column.FieldName = "AgeInYears";
column.Caption = "AgeInYears";
});
settings.Columns.Add(column =>
{
column.FieldName = "Sex";
column.Caption = "Sex";
});
settings.Columns.Add(column =>
{
column.FieldName = "AdmitDate";
column.Caption = "AdmitDate";
});
settings.Columns.Add(column =>
{
column.FieldName = "LOS";
column.Caption = "LOS";
});
settings.Columns.Add(column =>
{
column.FieldName = "DischargeStatus";
column.Caption = "DischargeStatus";
});
settings.Columns.Add(column =>
{
column.FieldName = "ROM";
column.Caption = "ROM";
});
settings.Columns.Add(column =>
{
column.FieldName = "SOI";
column.Caption = "SOI";
});
settings.Columns.Add(column =>
{
column.FieldName = "Category";
column.Caption = "Category";
});
settings.CommandColumn.ShowSelectCheckbox = true;
settings.CommandColumn.Visible = true;
settings.ClientSideEvents.SelectionChanged = "SelectionChanged";
settings.ClientSideEvents.RowDblClick = "function(s, e) { OnRowClick(s, e); }";
}).Bind(Model).GetHtml()
这是Javascript的相关部分。。。
function SelectionChanged(s, e) {
s.GetSelectedFieldValues("MedicalRecordNumber", GetSelectedFieldValuesCallback);
alert("new row selected");
}
function GetSelectedFieldValuesCallback(values) {
for (var i = 0; i < values.length; i++) {
var item = values[i];
}
}
正如我所说,GetSelectedVieldValuesCallback(values)函数没有被调用,而是返回undefined
。我非常仔细地学习这里的例子。
需要实现设置。CallbackRouteValues模式。
检查此KB以了解有关如何继续的详细信息。