How to make a Grid reread the number of rows in a Table?

I have used GridTableBase to make and display a Table using a Grid.

But if I add a new row to the Table the Grid will not display a new row.

So if I start with 9 rows in the table and add a row, so there is
10 rows in the table. But the Grid will only display 9 rows.

Is seems like the Grid don’t reread the the numbers of rows from
the Table.

How can I force the Grid to reread the number of rows?

Svend Haugaard Sørensen wrote:

How can I force the Grid to reread the number of rows?
grid.refresh(), I think

alex

On Sun, 06 Dec 2009 05:14:06 +0000
Alex F. [email protected] wrote:

the Table.

How can I force the Grid to reread the number of rows?

grid.refresh(), I think

grid.refresh and grid.force_refresh only update the data in the cells
but not the number of rows.

On Sun, 6 Dec 2009 16:50:12 +0100
Svend Haugaard Sørensen [email protected] wrote:

On Sun, 06 Dec 2009 05:14:06 +0000
Alex F. [email protected] wrote:

Svend Haugaard Sørensen wrote:

I have used GridTableBase to make and display a Table using a
Grid.

But if I add a new row to the Table the Grid will not display a
new row.

Okay I solved it by dropping the table and making a subclass of Grid.
And then using ‘append_rows’ and ‘delete_rows’ from the Grid class.

It seems like ‘set_table’ in Grid makes a clone of the table, and
thereby make it impossible to manipulate the table directly.

Thanks for the help.

Tony M. wrote:

Can anyone confirm this is the way to go?

Answering my own question - yes, that seems to do the trick. When the
underlying data changes, simply create a new table (a subclass of
GridTableBase to be exact) and call mygrid.set_table again. Voila.

On 23/02/2010 15:27, Tony M. wrote:

It seems like ‘set_table’ in Grid makes a clone of the table, and
thereby make it impossible to manipulate the table directly.

Can anyone confirm this is the way to go?

Yes, definitely. I looked at wxWidgets underlying C++ code for this a
while back. It clones the C++ object, so it’s likely the Ruby Grid class
will continue to have this behaviour.

a

Okay I solved it by dropping the table and making a subclass of Grid.
And then using ‘append_rows’ and ‘delete_rows’ from the Grid class.

It seems like ‘set_table’ in Grid makes a clone of the table, and
thereby make it impossible to manipulate the table directly.

Can anyone confirm this is the way to go?

On 23/02/2010 15:27, Tony M. wrote:

It seems like ‘set_table’ in Grid makes a clone of the table, and
thereby make it impossible to manipulate the table directly.

Can anyone confirm this is the way to go?

Yes, definitely. I looked at wxWidgets underlying C++ code for this a
while back. It clones the C++ object, so it’s likely the Ruby Grid class
will continue to have this behaviour.

a