cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

On clicking of the button i want to add a textbox dynamically. Whenever i click that button a new text box should be placed automatically

adityaku
1-Newbie

On clicking of the button i want to add a textbox dynamically. Whenever i click that button a new text box should be placed automatically

Whenever I am clicking on a button a new text box should be there on the mashup

12 REPLIES 12

You should use a Repeater.

HI Carles,

But how to use the repeater widget, as in repeater widget we give limitations, how much time it should repeat.

Hi, Repeater Widget doesn't have limitations, you should have a service on Server Side where you query for the content to show on the rows, and another service to add a new row.

Hi Carles,

Normal java script coding will work here to add a new row.

Hi,

We are not able to add the new row upon clicking of a button.

we are only able to add only one text box in one row.

What it should ideally do like that when i click on the button it should add a new text box. Please help us with the code.

Thanks,

Aditya Kumar

Hi,

We are not able to add the new row upon clicking of a button.

we are only able to add only one text box in one row.

What it should ideally do like that when i click on the button it should add a new text box. Please help us with the code.

We are using the repeater widget now.

Thanks,

Aditya Kumar

  1. Build a mashup with a repeater. Let's call it ParentMashup
  2. Build another mashup with a Textbox, that Mashup it's the one that you will repeat on the repeater. Let's call it RowMashup, which has a parameter called id, and another called text
  3. Build a service which adds a Row to a an infotable or datatable with, this row will record the value of the TextBox. Let's call it AddTextBox with a parameter "Text" with the desired text on the textbox.
  4. Build another service which returns the rows for this Infotable/Datatable. Let's call it GetRows
  5. Bind del result of the GetRows to the Repeater on ParentMashup, now you just need to select the corresponding parameters for RowMashup, your are done.

Hi,

Thank you Carles for the response. But we are struggling with the creation of the service which adds a Row to a an infotable or datatable with, which will record the value of the TextBox calledAddTextBox with a parameter "Text" with the desired text on the textbox.

Can you please help us in the creation of the service or provide us the sample code.

Thanks,

Aditya Kumar

Create a property on the Thing of type "INFOTABLE", name it myDummyInfotable. Create a DataShape for that infotable, with the desired columns (id, text)

On the Service AddTextBox ( which it's created on the same previous thing ):

var tmp = me.myDummyInfotable;

tmp.AddRow({ id: me.myDummyInfotable.length, text: Text });

me.myDummyInfotable = tmp;

Service GetRows should be just ( with a return value as Infotable with previously created DataShape ):

var result = me.myDummyInfotable

Hi Carles,

Thanks it helped us. We are able to create it.

If we want to create it with rest api service instead of using repeater.

For example:

if we have a situation like on selection of different options different different widgets should appear on the screen.

if we have selected one option radio button should come

if we have selected another option text button should come.

js widget = new js();

widget.addPanel(textBox);

Thanks,

Aditya Kumar

If you want to have different types of rows on the repeater ( on row with a text box, another with a combo, another with an image,...), you will need to record the mashup name on the Infotable, and use this MashupName to load the repeater entries.

Carles.

Thanks Carles

Top Tags