我有一个DevExpress MVC GridView,我只想在客户端处理SelectionChanged事件,并使用AJAX自己将任何帖子连接到服务器。
我的GridView调用我的SelectionChanged()
函数,但该函数中的代码s.GetSelectedFieldValues("MedicalRecordNumber", GetSelectedFieldValuesCallback);
似乎什么都不做,并且GetSelectedFieldValuesCallback(values)
没有被调用。
这是我的GridView局部视图,它没有markkup ......
@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
。我非常密切地关注了here提供的示例。