XAF группировка веб-столбцов
Если у кого-то есть работа с eXpressApp Framework (XAF), я пытаюсь сгруппировать listView по одному или двум столбцам в коллекции, веб-модуль без удачи, заранее спасибо
Private Sub SCA_ViewBy_Execute(sender As Object, e As SingleChoiceActionExecuteEventArgs) Handles SCA_ViewBy.Execute
If SCA_ViewBy.SelectedIndex = 0 Then
Dim listEditor As GridListEditor = TryCast((CType(View, ListView)).Editor, GridListEditor)
If listEditor IsNot Nothing Then
Dim gridView As GridView = listEditor.GridView
gridView.BeginSort()
Try
gridView.ClearGrouping()
gridView.Columns("Division").GroupIndex = 0
gridView.Columns("SubDivision").GroupIndex = -1
Finally
gridView.EndSort()
End Try
End If
ElseIf SCA_ViewBy.SelectedIndex = 1 Then
Dim listEditor As GridListEditor = TryCast((CType(View, ListView)).Editor, GridListEditor)
If listEditor IsNot Nothing Then
Dim gridView As GridView = listEditor.GridView
gridView.BeginSort()
Try
gridView.ClearGrouping()
gridView.Columns("Division").GroupIndex = 0
gridView.Columns("SubDivision").GroupIndex = 1
Finally
gridView.EndSort()
End Try
End If
End If
End Sub
1 ответ
Спасибо, я нашел решение, которое работает
Private Sub SCA_ViewBy_Execute(sender As Object, e As SingleChoiceActionExecuteEventArgs) Handles SCA_ViewBy.Execute
If SCA_ViewBy.SelectedIndex = 0 Then
' Dim listEditor As GridListEditor = TryCast((CType(View, ListView)).Editor, GridListEditor)
' If listEditor IsNot Nothing Then
' Dim gridView As GridView = listEditor.GridView
' gridView.BeginSort()
' Try
' gridView.ClearGrouping()
' gridView.Columns("Division").GroupIndex = 0
' gridView.Columns("SubDivision").GroupIndex = -1
' Finally
' gridView.EndSort()
' End Try
' End If
Dim listEditor1 As ASPxGridListEditor = TryCast((CType(View, ListView)).Editor, ASPxGridListEditor)
If listEditor1 IsNot Nothing Then
Dim gridView As ASPxGridView = CType(listEditor1.Grid, ASPxGridView)
gridView.ClientInstanceName = View.Id
Dim divisionColumns As GridViewDataColumn = TryCast(gridView.Columns("Division"), GridViewDataColumn)
'Dim subdivisionColumns As GridViewDataColumn = TryCast(gridView.Columns("SubDivision"), GridViewDataColumn)
If divisionColumns IsNot Nothing Then
'detailsColumns.DataItemTemplate = New UpDownButtonsTemplate()
gridView.ClearSort()
gridView.SortBy(divisionColumns, DevExpress.Data.ColumnSortOrder.Ascending)
gridView.GroupBy(divisionColumns, 0)
gridView.ExpandAll()
End If
End If
ElseIf SCA_ViewBy.SelectedIndex = 1 Then
Dim listEditor1 As ASPxGridListEditor = TryCast((CType(View, ListView)).Editor, ASPxGridListEditor)
If listEditor1 IsNot Nothing Then
Dim gridView As ASPxGridView = CType(listEditor1.Grid, ASPxGridView)
gridView.ClientInstanceName = View.Id
Dim divisionColumns As GridViewDataColumn = TryCast(gridView.Columns("Division"), GridViewDataColumn)
Dim subdivisionColumns As GridViewDataColumn = TryCast(gridView.Columns("SubDivision"), GridViewDataColumn)
If divisionColumns IsNot Nothing Then
'detailsColumns.DataItemTemplate = New UpDownButtonsTemplate()
gridView.ClearSort()
gridView.SortBy(divisionColumns, DevExpress.Data.ColumnSortOrder.Ascending)
gridView.GroupBy(divisionColumns, 0)
gridView.GroupBy(subdivisionColumns, 1)
gridView.ExpandAll()
End If
End If
Else
End If
End Sub