クライアント側でのみ SelectionChanged イベントを処理し、AJAX を使用して自分でサーバーに投稿を配線する DevExpress MVC GridView があります。
私の 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
。ここで紹介した例に非常に厳密に従っています。