How Can I Customize The Field Editor Behavior?

By default the Data Grid field editor allows users to enter data and save it back to the Data Grid. If you need data entry to behave differently you can assign your own behavior script to the field editor before it opens. This lesson will show you how.

Create Your Behavior Script

Create Your Behavior Script

1) Create a button to hold the behavior script you want to use with the Data Grid field editor. I've placed this button on the same card as the data grid.

2) Set the script of your button to the script of the behavior of button "Field Editor" of stack "revDataGridLibrary". This is the behavior script that Data Grid uses by default and is a good place to start when customizing the behavior.

set the script of button "Custom Field Editor Behavior" to the script of the behavior of button "Field Editor" of stack "revDataGridLibrary"

Customize Your Script

Customize Your Script

Make any customizations you need to make.

Assign Your Custom Behavior to Field Editor

Assign Your Custom Behavior to Field Editor

Whenever the Data Grid displays the field editor (e.g. the user double-clicks on a cell in a table) a preOpenFieldEditor message is sent the Data Grid. The first parameter is a reference to the field editor control. This is where you can assign your behavior script to the field.

3 Comments

Simon Knight

This caused me problems as initially I had my behavior button stored first on the column template and then on a group that the datagrid was part of. In these locations the preopenfieldeditor script failed to find the behavior button which results in a "silent" failure where the datagrid stops allowing cell editing. This failure was corrected by entering the full long ID of the behavior button which restored cell editing but my behavior code was still not being called. It was only called when I placed the button on the parent card/stack.

Klaus Major

Please, please, please update all relevant (complex things like the DG) lessons to reflect the changes in the IDE and libraries and whatnotall! E.g. This results in an empty script:
...
set the script of btn "my custom field editor thingie" to the script of btn "Field Editor" of stack "revDataGridLibrary"
...
It needs to read:
...
set the script of btn "my custom field editor thingie" to the script of the behavior of button "Field Editor" of stack "revDataGridLibrary"
...
This is not something that will make a newbie happy! :-/

Elanor Buchanan

Hi Klaus

Thanks for brining that to our attention, I have updated the lesson with the correction.

Kind regards

Elanor

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.