enjoyit
2016-04-13T13:44:31Z
Hi,

how could I set the default alignment of a cell (left, center, right) when I fill my grid from an recordset?


thanks!
Igor/10Tec
2016-04-13T14:11:18Z
I would use the following technique:

1) Create the column set using the igFillRSRecreateColsOnly value for the eMode parameter of FillFromRS. This call will create the columns for your fields from the recordset, but the rows won't be added.

2) Then set the default alignment for the required columns using the column default cell object (ColDefaultCell). You can use field names as column keys to find the columns to set alignment for.

3) Finally call FillFromRS with eMode set to igFillRSColsIfEmptyAndRows (or simply omit this default value) to populate cell values.

Your code will look like the following code snippet:

iGrid1.FillFromRS rs, igFillRSRecreateColsOnly
iGrid1.ColDefaultCell("Title").eAlignH = igAlignHCenter
iGrid1.FillFromRS
enjoyit
2016-04-13T14:29:03Z
works great!

thank you! 🙂