Editable table with repeater, input field and button

Hi!

This can be done with very little code for as many rows as needed using the “listener method.” Here is a brief description of how the listener method works:

  • Execute a command (Move by 0,0 is traditional) on a widget in the repeater from outside of the repeater. This moved item in the repeater is the listener. Note that the move command must be initiated from outside of the repeater, such as in OnClick of an external button.
  • When this happens, the listener will receive the OnMove message for each row of the repeater in the context of each row.

“In the context of” means that the listener’s OnMove code will have access to all of each row’s properties. It can examine [[Item.columnName]], [[Item.index]], [[Item.isMarked]] etc., the same way as OnItemLoad does. In fact, when writing the OnMove code for a listener, write it the exact same way you would write an OnItemLoad handler. Think of the listener as a highly targeted OnItemLoad designed to perform a specific task.

In your case, you want to mark the row OnTextChange of the field, and then have the listener check if that row is marked, and if so disable it.

OnTextChange (of field in repeater)
  Mark row (This) in repeater

OnClick (of button outside of repeater)
  Move (hotspot) "listener" by 0,0

OnMove (of hotspot "listener" inside of repeater)
  If (value) [[Item.isMarked]] is equal to true
    disable (text field)

File: listener_disable_field_of_marked_row.rp (47.3 KB)

Note that these values are not stored in the dataset of the repeater (there isn’t even OnItemLoad code), meaning that if you execute any repeater command on the repeater (aside from marking rows), all values will disappear.

If you need to retrieve values from specific rows, however, you can also do that with a (separate) listener without making the values disappear. See this post.

1 Like