Creating dynaming instances in flex repeater

hi,
I want to create and delete dynamic text filed as a instances in flex repeater using script .Also want to store that value as a dataset.

i tried with message handler but i don’t know what message to send as a trigger point.

any suggestions pls?

I’m not sure I understand.
You want to use a text field as the repeated view of a flex repeater, each of those having a dynamic value ? And store those values as a dataset ? Is that correct ?

In any case, my first question would be: What is the end goal ?
second question: How are the values computed ?

your understanding is correct.

My requirement is having the text field as dynamic not only the values .

My end goal will be if I have certain conditions according to that instances should change dynamically …for example if i want only 10 text field, i should have only 10 text field in my view. Next time the condition changes. i should also want to delete the instances i need.

i hope you understand my question.

Can you explain what will determine the number of instances, and then what should happen individual instances ? I’m not sure what you mean by ‘dynamic text field’.

Having a dynamic number of instances is easy enough, all you need to do is bind the instances property of the flex repeater against whatever will determine the number of instances, and process this to return an array dicts containing the params required by the instanced view.

Then, the content of the instances can be determined there and passed as params. The binding can be reevaluated to change the params, and this change the content of the instances.
If this is not acceptable, messages can be used, with a handler configured on the instanced view. You’ll have to find a way to identify each instance, so that only the right one processes the message. This could be done by passing an id as parameter to each instance, and matching that id in a parameter of the message’s payload.

If you can be more specific about what you’re working with, someone around here will probably have a better answer.

If you only need textfields, it might be interesting to look into the table component.With editable columns you basicly have a texfield “repeater”

3 Likes

To be more precise i want my instances to increase and decrease using a script when i click a button.

Okay, but what do you want to do ? What’s the goal ? We still don’t know what goes in the making of your text field array or what it should be in the end. Maybe it’s session specific, maybe it’s global, maybe the text fields should be already filled from existing data… etc. Those are not just details.

A simple table might as suggested by victor might be enough, though I seem to always have issues with editable table…

From other posts:
Dynamic Flex Repeater - dataset binding with instances

Dynamic Flex Repeater Instances

I've noticed that when I'm adding instances manually the parameters doesn't sync automatically. Is that an issue when adding a parameter by code?

What do you mean ? I’ve never noticed that…

I have 2 params:
image

I grab a Flex Repeater, add a path and an instance
image

Since I get no parameters I have to add them manually.
image

Now I have them
image

I was wondering if that’s an issue when adding instances by script?

When adding instances by script you will need to add any parameters that are needed in the script. In my experience this still works as expected. The Sync Params buttons are really just a short cut to help you not have to add the parameters one by one.

1 Like

Well you'll have to build an array of dicts, each containing the required parameters, there's no way around that. There's no issue here.