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

OnQueryCanMergeCells

I just rewrote the VitrualMergeCell sample to fit my needs, but I have one problem : works great for any cell except for the row header column. If I put duplicates consecutive rows anywhere but the first column, merge great, but if it''s in the first, it repeats without merging. Whats wrong?

7 Replies

MC Martin Cyr July 4, 2005 03:47 PM

I found something strange : when I set only Cols.HeaderCount = 0 the first columns won''t merge but if I add Cols.FrozenCount = 1 then it does merge, but I get a blue dotted line after the next column...


AD Administrator Syncfusion Team July 4, 2005 03:47 PM

The sample seems to work ok for row headers. What did you change? Did you change this code? GridStyleInfo rowHeaderStyle = BaseStylesMap["Row Header"].StyleInfo; //rowHeaderStyle.CellType = "Static"; rowHeaderStyle.MergeCell = GridMergeCellDirection.RowsInColumn; which is where the merge is enabled on the row headers. Does this code get hit in your sample?


MC Martin Cyr July 4, 2005 04:06 PM

Yes, I have this code and it gets hit. The problem is that I do NOT want 3 frozen and 2 headers cols. Try it in your sample. Just change Cols.HeaderCount = 1 Cols.FrozenCount = 2 to Cols.HeaderCount = 0 Cols.FrozenCount = 0 Since the default header is still there and is frozen, it''s all that I need (esthetically I mean), but with this code, the first column doesn''t get merged.


MC Martin Cyr July 5, 2005 07:47 AM

Until I get an answer, I did this to fix the problem, but it is only a workaround (I still need an answer ;). Sadly this messes all my arithmetics and logics. Cols.HeaderCount = 1 Cols.FrozenCount = 1 ColHiddenEntries.Add(New GridColHidden(0))


MC Martin Cyr July 5, 2005 08:17 AM

After further investigation, I can see that OnQueryCellModel never gets called for col 0 (but it gets called for row 0). Any hints on why that is?


AD Administrator Syncfusion Team July 5, 2005 11:19 AM

This is being looked into. It is not clear yet whether there was a necessary reason for not allowing this to work for the row header column though it is strange that setting FrozenCount = 1 does allow it to work. You can work around this issue using covered cells by adding an OnQueryCoveredRange override to CustonGridModel. Protected Overrides Sub OnQueryCoveredRange(ByVal e As Syncfusion.Windows.Forms.Grid.GridQueryCoveredRangeEventArgs) If e.ColIndex = 0 AndAlso e.RowIndex > Me.Rows.HeaderCount Then Dim top As Integer = e.RowIndex Dim val As Object = Me(e.RowIndex, e.ColIndex).CellValue While top > Me.Rows.HeaderCount AndAlso val.Equals(Me(top - 1, e.ColIndex).CellValue) top -= 1 End While Dim bot As Integer = e.RowIndex While bot < Me.RowCount AndAlso val.Equals(Me(bot + 1, e.ColIndex).CellValue) bot += 1 End While If bot <> top Then e.Range = GridRangeInfo.Cells(top, 0, bot, 0) e.Handled = True End If End If End Sub


AD Administrator Syncfusion Team July 5, 2005 12:11 PM

This is a defect that has been corrected here in our code base.

Loader.
Live Chat Icon For mobile
Up arrow icon