Problem with editing a field in a datagrid

Peter Haworth pete at
Mon Mar 28 14:40:07 EDT 2011

I'm using a CloseFieldEditor handler to update the results of a user's changes to a datagrid text column into a database.  Works fine except when the data in the column has been processed using the datagrid TruncateTail function and the data is too wide to fit in the column.  In those circumstances, the data in the column is truncated and "..." is placed at the end of it to show it has been truncated.  So if the original text is "This a string of text that won;t fit in the width of my column", TruncateTail turns it into  "This a string of text that won;t fit in the width..." or something similar for display in the datagrid.

When I double click on the column to edit it, the editor field contains the truncated text, not the complete text so when I get the new value in CloseFieldEditor, I end up putting a string ending with the "..." chars instead of the full text.

Seems to me that when a user opens up a column for editing, the full text of the field should be placed in the field editor, not the truncated version but this isn't happening so I guess I'm going to have to do this myself but I'm not sure where to start.  

I see a mouseDoubleUp handler in the datagrid column behavior script that calls EditCellOfIndex.  It seems like I will need to grab the un-truncated version of the text at that point and put it into the column being edited but before I go down that path, has anyone run into this and found a way to have the datagrid deal with it?

Pete Haworth

More information about the use-livecode mailing list