We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Column header issues in a databound grid

Hello, First a little background. I have just begun to evaluate the Syncfusion components, particularly the grid. So far I am very pleased with what I have seen. I am in charge of implementing a grid control that operates with the same functionality has Outlook 2000's Supergrid. I've evaluated many different grids and lists and so far Syncfusion has prooved to be the the best. Essential Grid offers the closest functionality to the Supergrid I've seen as well as the extensibility to be able to polish it off. I cant wait to convince my supervisor to license these components. Now to get to the points of this post. I am using a data-bound grid in VB.NET. I have not begun to evaluate the non data-bound grid but I know I'll be using it as well. 1. I need to be able to both sort and reorder the columns with a single mouse click but if I set the Sort Behavior to single click I cannot grab and drag my columns anymore. 2. I'd like column headers to display with character ellipsis trimming but if I set my base style column header trimming to EllipsisCharacter I still only receive character trimming (wrapping is disabled). 3. UI feedback needs to be added for column headers. When you click them there is no indication that they have been clicked other than that the sort-arrow appears or changes direction. They should act like buttons, pushed in when clicked. Is there a setting that I am missing or is there an easy way to make this happen? 4. I'd also like a copy of the column header to be drawn under my mouse cursor while I am dragging it for reordering. This makes it more apparent to the user what is happening. I consider the first two points to be bugs, the others implementation details. Can anyone tell me what events/methods are most appropriate to override for me to implement these features? Thank you for your time, Brian Bacon

2 Replies

AD Administrator Syncfusion Team October 8, 2003 05:48 PM UTC

Brian, Thank you for evaluating our controls. Regarding your second question. Did you try it as follows: With Me.gridDataBoundGrid1.BaseStylesMap("Column Header").StyleInfo .Trimming = StringTrimming.EllipsisCharacter .WrapText = False End With That should normally work. If not I'll check again with the 1.6.1.0 codebase (which the eval is based on). Maybe we fixed it in a later patch. To give UI feedback when mouse is pressed on a header you could override or add event handlers for the following events: Dim mouseDownColIndex = -1 Protected Overrides Sub OnCellMouseUp(ByVal e As Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs) mouseDownColIndex = -1 MyBase.OnCellMouseUp(e) End Sub Protected Overrides Sub OnCellMouseDown(ByVal e As Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs) If (e.RowIndex = 0) Then mouseDownColIndex = e.ColIndex RefreshRange(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)) End If MyBase.OnCellMouseDown(e) End Sub Protected Overrides Sub OnPrepareViewStyleInfo(ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) If e.RowIndex = 0 Then If e.ColIndex = Me.mouseDownColIndex Then e.Style.BackColor = SystemColors.Highlight ' or 'e.Style.CellAppearance = GridCellAppearance.Sunken Else 'e.Style.CellAppearance = GridCellAppearance.Raised End If End If MyBase.OnPrepareViewStyleInfo(e) End Sub Protected Overrides Sub OnCellHitTest(ByVal e As Syncfusion.Windows.Forms.Grid.GridCellHitTestEventArgs) If (e.RowIndex = 0) Then e.Result = 1 e.Cancel = True End If MyBase.OnCellHitTest(e) End Sub I have to look into how to make SingleSelect and Selecting cells work at the same time. It's original intention for SingleSelect sorting was that at the same time the selection of columns should be disabled. But let me also point you to the Grid\Samples\Grouping demo. There you can drag column headers, give visual feedback while dragging with a bitmap of the header and also handle single-click sorting. This is implemented by a special mouse controller that handles both dragging the column header and single-click sorting. Such a mouse controller could be ported to the databound grid to give it the same behavior. Stefan


BB Brian Bacon October 9, 2003 11:19 AM UTC

Stephan, This all sounds too good to be true and that grouping demo is exactly what I want. Now my only problem seems to be waiting for my supervisor to come back from vacation so I can show him all this wonderful stuff.

Loader.
Live Chat Icon For mobile
Up arrow icon