Row addition in Repeater


Hello Friends,

This is repeater related query, I have simple repeater control with single column and grow vertically
the expected behaviour is to add new Row from drop-down list (custom control) said list has 4 choices and each of choice add new row with few form fields.
I have this draft version which work perfect to add First Row, however when I tried to add another row from new row it changes earlier added row and its respective form fields.
I’m sure how to retain form fields of earlier added rows and bring in another row with its own form fields.
I’m not able to understand how to give unique id to newly added row?
Another issue is with my drop-down list (Custom Control) how to retain the selected name, as it resets as soon as I interact to drop-down list from newly added Row?

Thank you,
VijuAddRow.rp (111.4 KB)


There is nothing that simple about your repeater, it is actually fairly complex. It took a LOT of work to start getting this to work properly. I won’t explain most of it, but you can see below for an updated .rp file that should get you going.

Any time you update a repeater, like adding or deleting a row, filtering, sorting, etc. the whole repeater gets rebuilt, resetting all widgets in the repeater to their defaults–as they are in the editor. You need to store anything that gets changed as data in the repeater’s data sheet. The best way to do this is to create a column for every unique data element, then assign that column to a widget and/or create some conditional cases in the repeater’s Item Loaded event to handle things.

…Do you mean you are not sure how to do these two things? Your repeater doesn’t have anything like this. For the first aspect, retaining form fields (data), It looks like, across your four types of items you have 13 data fields. So, you could add 12 more columns to your data sheet in order to track them all, plus a column for the item category (“item 001”, “item 002”, etc.) and a column for a unique row ID. Then you can assign a related widget (e.g., a text field in one of your dynamic panel’s states) to each column. It looks like each item type has a “Name” field, so you can use the existing “First_Name” column in your data sheet (unless each item category’s Name needs to be unique, in which case you’d want 4 columns for this, something like Name1, Name2, etc.) For now let’s assume you can reuse the Name. In addition to this “Name” column, you’d have:

  • (from the “item 001” selection’s fields):
    • Location
    • Size
    • Class
    • Mode
    • Pool
    • Switch
  • (from item 002):
    • Path
    • Count2
  • (from item 003):
    • Provider
  • (from item 004):
    • Count4
    • Space
    • Value

For the second aspect, “bring in another row with its own form fields”, you’ll need to track what kind of item it is, 001, 002, 003, or 004. You are already setting the dynamic panel state after adding a row, but in order to retain this, you’ll need a column for the type of item. The word, “Item” is already taken, as it is used by Axure to refer to a row–so each row in a repeater is a repeater item. You could use a column name like, “Category” for example. In the repeater’s Item Loaded event you’d want to include an action to handle this, something like,

Item Loaded
Set Panel State
(Dynamic Panel) to [[Item.Category]]

See my previous paragraph above. Same method here: add a column for the ID and refer to it with the expression [[Item.ID]] , where the column is named, “ID”. In my example below, I demonstrate this is being set (and read) by changing the text for the “This row can be Modify” widget, to “Row [[Item.ID]] can be modified.”

If I understand you correctly here, you want the “Select item from list:” droplist to read, “item 001” (or whatever chosen item type) instead of “Select” for a newly added row. You can handle this in the repeater’s Item Loaded event. Since you already have a different droplist (e.g., “dropDown-1”) in each of your four dynamic panel states, the most straightforward way would be to just set the text in each of these states so it looks the way it should. Basically, replace “Select” with the current item type. Or, you could use conditional cases in the Item Loaded event, testing the value of the Row_Type column and changing the associated “Select” widget’s text to that column value. See the repeater’s Item Loaded event (as well as the connected widgets in the data sheet) to inspect how I handle this. As each item/row is loaded (and/or updated/edited) all the widgets in the repeater are set based on the data sheet. Also note the Click or Tap events for the droplist widgets (“item 001”, “item 002” etc.) are greatly simplified–only one line of code needed for each–the items in the “default” state will add a new row, assigning an ID and Category; the items in the other states are only seen/used for an existing row, so they merely edit the current (this) row data, updating the Category column, thus changing the “ItemType” dynamic panel in the repeater.

AddRow.rp (206.6 KB)


This is really great and highly appreciated…
You splited my longer query into 5 small chunks and explain that really well

on the splited chunk #3
<I’m sure how to retain form fields of earlier added rows a…>
Yes you are right, I mean here I’m not sure, apologies for confusion

All in all looks like you took sufficient time to solve my query
you deserve Cigar from me :slight_smile:

Thanks a ton,