Hi folks,
I have a grouping function on a ComboBoxEdit (code below). How do i transfer this to a RepositoryItemComboBoxEdit located on a Menubar (BarManager). I have read all articles and KB's but cannot get it working. I have tried the code at the end but not working.
Private Sub cbEquipListGrouping_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbEquipListGrouping.SelectedIndexChanged
If cbEquipListGrouping.EditValue.ToString().IndexOf("----") >= 0 Then
cbEquipListGrouping.SelectedIndex = cbEquipListGrouping.Properties.Items.Count - 1
Else
SetGroupIntervalEqList(cbEquipListGrouping.SelectedIndex)
End If
End Sub
Private Sub SetIntervalEqList(ByVal column As GridColumn, ByVal interval As ColumnGroupInterval)
column.GroupInterval = interval
column.GroupIndex = 0
End Sub
Private Sub SetSortModeEqList(ByVal column As GridColumn, ByVal sortMode As ColumnSortMode)
column.SortMode = sortMode
column.GroupIndex = 0
End Sub
Private Sub SetGroupIntervalEqList(ByVal index As Integer)
AdvBandedGridView2.BeginSort()
Try
AdvBandedGridView2.ClearGrouping()
For Each column As GridColumn In AdvBandedGridView2.Columns()
column.GroupInterval = ColumnGroupInterval.Default
column.SortMode = ColumnSortMode.Default
Next column
Select Case index
Case 0
SetIntervalEqList(colEnquiryPackage, ColumnGroupInterval.Value)
colSkidReference.GroupInterval = ColumnGroupInterval.Value
Case 1
SetIntervalEqList(colSkidReference, ColumnGroupInterval.Value)
Case 2
SetIntervalEqList(colEquipTag, ColumnGroupInterval.Value)
Case 3
SetIntervalEqList(colSpecNo, ColumnGroupInterval.Value)
Case 4
SetIntervalEqList(colLocation, ColumnGroupInterval.Value)
Case 5
SetIntervalEqList(colPIDNo, ColumnGroupInterval.Value)
Case 6
AdvBandedGridView2.CollapseAllGroups()
colSkidReference.SortOrder = ColumnSortOrder.Ascending
End Select
Finally
AdvBandedGridView2.EndSort()
AdvBandedGridView2.CollapseAllGroups()
End Try
End Sub
Tried Following Code (Not Working)
Private Sub BarEditItem1_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs) Handles BarEditItem1.ItemClick
Dim val1 As Object = BarEditItem1.EditValue
Dim selectedIndexInBar As String = RepositoryItemComboBox9.Items.IndexOf(val1)
If BarEditItem1.EditValue.ToString().IndexOf("----") >= 0 Then
val1.selectedIndexInBar = val1.Properties.Items.Count - 1
Else
SetGroupIntervalEqList(val1.selectedIndexInBar)
End If
End Sub
Any help appreciated.
Thanks,
Brian
Hi Brian,
Thank you for your message.
If I understand you correctly, you wish to catch the moment when an end-user changes an edit value of an in-place ComboBoxEdit and obtain its SelectedIndex property's value.
If so, to achieve the required result, handle the RepositoryItemComboBox.EditValueChanged event, cast the sender to ComboBoxEdit and access its ComboBoxEdit.SelectedIndex property.
We hope that you find this information helpful.
Thanks,
Svetlana
Hi Svetlana,
Thanks for reply however i have tried a lot of things and still not working as i am not understanding correctly how to do it.
I need users to pick values in the RepositoryItemComboBoxEdit in the bar manager and sort the grid accordingly.
Do you have a VB demo showing this functionality that i can follow please. I have downloaded other demos but none are what i require.
Thanks,
Brian
Hi Brian,
I have created a small sample project illustrating how your task can be accomplished.
Please review it and let me know if it helps.
Thanks
Dimitros
Hi Dimitros,
Many thanks. Apologies, i meant to say i require column grouping instead of column sorting.
Please find attached my test project. The existing code is working correctly for a normal comboxedit on my other application and i need the same grouping functionality to work with a new project for the RepositoryItemComboBox in the menubar. This should allow the user to choose an item (Name of Column from Grid) and then the grid is grouped by this column selection.
Can you modify the code to suit column grouping instead of column sorting please.
Thanks,
Brian
Hi Brian,
I have modified your sample based on your requirements, and now it works as expected here. Please refer to the attached project.
We look forward to your feedback once you have had the opportunity to review the sample project.
Thanks,
Svetlana
Hi Svetlana,
That is perfect and working great.
Many thanks,
Brian
Hi Brian,
Please do not hesitate to contact us in case of any difficulty. We will be happy to help you resolve any problem! :)
Thanks,
Svetlana
Thanks a million