Data Grid and per column allow editing
lists at mangomultimedia.com
Tue Jun 16 08:29:51 CDT 2009
On Jun 15, 2009, at 2:57 PM, mfstuart wrote:
> Using the Data Grid control, I have 4 columns defined. Columns 1
> through 3,
> I don't want to allow editing, but column 4 allow editing.
> How can I do this? Because the Allow Editing property is for the
> Data Grid
> itself, not per column.
I started to put a lesson together on how to do this but once I got to
the part about taking tabbing into account I gave up as it would be
way too much work to implement outside the data grid. So here is an
updated revDataGridLibrary with a new property:
set the dgColumnIsEditable ["Col 1"] of group "DataGrid" to true
put the dgColumnIsEditable["Col 1"] of group "DataGrid"
I updated the data grid to take this property into account when
deciding whether or not a cell should be open for editing. Note that
"allow editing" will turn off all editing if set to false. So make
sure it is true and then turn off column editing as needed for
Download this file, unzip it and place it in the ./Toolset folder of
your Rev installation (back up existing stack first).
I will be linking to this stack from the docs here pretty soon and at
that point I will update the docs with new information. You can find
the change log below.
Blue Mango Learning Systems
www.bluemangolearning.com - www.screensteps.com
* Added RefreshIndex and RefreshLine. Calling either one will redraw
index/line with current data.
* Added dgColumnIsEditable property for each column. Default is true
but if "allow editing" is false for data grid then no editing is
* Updated default column behavior to take dgColumnIsEditable property
* Tabbing through editable table cells now skips columns that have
dgColumnIsEditable property set to false.
* Added ColumnControlOfIndex(pColumn, pIndex) which can be used for
getting the control for a column of index pIndex.
* Added the 'effective scrollbar width' property which always returns
an integer (scrollbar width can be set to "auto").
* EditCellOfIndex now scrolls grid horizontally so that pCell is in
* Updated default column behavior to call EditCellOfIndex so that
column would be scrolled into view horizontally if not completely
* When CloseFieldEditor and ExitFieldEditor are sent during automatic
saving of data they are now wrapped in try/catch blocks so errors
don't leave the editor field dead in the water. If the data grid
wasn't automatically saving data errors were properly caught.
* When pressing tab key while editing cell of table with single column
editing field closes. Previously the field would remain open and
nothing would happen as behavior was to try and go to next cell in row
* "column widths" was not looping through columns properly.
* "column widths" now uses the last integer in the list for all
columns without a valid value in the list.
* Fixed a typo in the error reporting dialog that appears if an error
happens in row template script.
* Field editor is now deleted before redrawing data grid.
* Adding new data to the data grid when fixed row height = true now
reconfigures scrollbar appropriately.
* dgDataOfLine was not refreshing the data grid view.
* selectionChanged in editor field is now trapped so selectionChanged
never reaches group. This avoids unexpected selectionChanged messages.
Developer can override field editor behavior to process
* Empty lines when setting the dgText would mess things up.
* Fixed a default value issue when working with dgTemplateFieldEditor.
More information about the use-livecode