Invisible_Monster
Invisible_Monster

Reputation: 25

How to add a column without breaking the grid (cxgrid)?

I have a cxgrid with data bind and I want to display an extra column that is not showing:

So I use "Customize..." from the cxgrid interface: enter image description here

The column selected above, has Visible set as False, that's why is not showing yet;

FieldName: CODIGO_PRIORIDADE

ValueType: Float

I tried to set it to Visible, it doesn't appear in the grid. If I move its position to below or above, it completely breaks my grid, modifying the Name of all the Grid Column to 1 as well, example: enter image description here

How can I properly set this new column to the last position of the grid based on data bind without breaking it?

Upvotes: 1

Views: 420

Answers (1)

You can do the column visible using the object TFloatField associated to field CODIGO_PRIORIDADE using:

cxGrid1DBTableView1CODIGO_PRIORIDADE.Visible := True;

To send the column "to the last position of the grid", you should do it using the visible columns of the grid, with VisibleColumnCount property:

cxGrid1DBTableView1CODIGO_PRIORIDADE.Index := cxGrid1DBTableView1.VisibleColumnCount;

Upvotes: 2

Related Questions