Editable table with repeater, input field and button

repeater-widget

#1

Test1.rp (50.9 KB)
Hi there

Again I am struggling with repeater stuff…

So: I have a repeater with input fields to visualize an editable table. The workflow should be:

  • You see editable empty input fields
  • You edit the input fields ( in different rows)
  • You click on a button outside the repeater
  • On click, input fields should be disabled but the values should still be seen and the same you just gave in.
  • Only the input fields that were just edited should be disabled, there are more field, that should still be editable.

I tried many different things, and the outcome so far were: Input field is not disabled, input field is disabled but all of them in the whole repeater, input fields all take the same value after clicking the button… you see, I am desperate. I tried first to tell the button something like: on click, please do something with the input fields that are in a marked row. But this didn’t work. So now I am trying to hand over the data from the input fields into global variables, but it still doesn’t work.

I attach my current test file, only with one row for the beginning. So: edit the fields, click on the button and I still see the values and the fields are disabled (sorry, didn’t put in so far the disabling thingy in this test file, because I am still stuck at the “store the values” part.

If you feel like you also have a solution for only addressing the marked fields, please let me also know :slight_smile:)

I am glad for any help!

Thanks, Cora


#2

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.


Repeater delay - each row - no local variable, no wait-fx
#3

Thank you so much, the whole idea with the listener really solves all my problems :slight_smile: I would have never thought about this idea, so thanks a lot :slight_smile:


closed #4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.