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

Formatting columns in virtual grid

I am trying to find a way to dynamially change column formatting in virtual grid when the user rearranges columns using drag and drop. I need to format dates, numbers, currency fields etc. I could not find a good example, but here is what I came up with: vGrid.Model.ColStyles[i].Format= "d"; //or another format specifyer However, it does not work and even when I read this property right after I set it I am getting "" (an empty string) Anybody knows how to handle this? Your help is appreciated

3 Replies

AD Administrator Syncfusion Team February 14, 2005 09:58 PM UTC

In a virtual grid, you can set a column format using QueryCellInfo. Check for e.ColIndex equal to the column you want to set and check e.RowIndex == -1, and then set e.Style.Format.


IV Igor Volnov February 15, 2005 12:43 AM UTC

Is not it better performance wise to set formatting on the column level once, rather than setting it for each individual cell on the grid?


AD Administrator Syncfusion Team February 15, 2005 01:58 AM UTC

There are no colstyles allocated in a true virtual grid. If you want to allocate the column styles, then you should not use QueryColCount, but instead just explicitly set grid.ColCount. This will allocate the storage required for the ColStyles and then you should be able to set them directly (provided your QueryCellStyleInfo code does not change the e.Style when e.RowIndex == -1 and e.ColIndex > 0).

Loader.
Live Chat Icon For mobile
Up arrow icon