[fxruby-users] Updating rows in a table
Lyle Johnson
lyle at lylejohnson.name
Thu Aug 20 10:16:56 EDT 2009
On Thu, Aug 20, 2009 at 4:18 AM, Martin Hawkins<martin.hawkins at gmail.com> wrote:
> I'm loading data from a SQL table using activerecord and displaying it in a
> table. At the moment I'm iterating through the table,so the code is as
> follows:
<snip>
> I want to be able to edit, add and delete. Using SEL_REPLACED I can detect
> when a cell has been edited and so can update the record based on row and
> column position. This is not good enough as the SQL table entries are not necessarily
> unique.
I don't understand what the fact that SQL table entries aren't
necessarily unique has to do with it. When a table cell is edited, the
table sends a SEL_REPLACED message to its target, and the message data
is an FXTableRange instance indicating which cell(s) were modified. So
you should be able to do something like this to determine which row
and column was edited:
table.connect(SEL_REPLACED) do |sender, sel, table_range|
puts "finished editing the cell at row=#{fm.row}, col=#{fm.col}"
end
Hope this helps,
Lyle
More information about the fxruby-users
mailing list