0

how to create another (textbox/combobox) dynamically when i click a button with simple mvc

asked 2012-12-13 04:10:11 +0800

somsaktk36 gravatar image somsaktk36
9

updated 2012-12-13 04:11:08 +0800

dear, i can only program with simple mvc and can't do with mvvm

I have grid-no-effect and button in out of grid.
1. When i click this button i need to generate another combox, textbox and button in another row

       <button id="btnGenRow" ></button>
       <grid sizedByContent="true" sclass="grid-no-effect" style="background: none;"   oddRowSclass="none">
                  <columns vflex="1" >
                            <column style="min-width:240px" align="left" ></column>
                            <column style="min-width:200px" align="left" ></column>
                            <column style="min-width:120px" align="center" ></column>
                  </columns>
                  <rows id="attachRows" >
                       <row >
                             <combobox id="cmbAttachType" style="min-width: 100px" />
                             <textbox id="txtAttachname" style="min-width: 120px" />
                             <button id="btnSelectAttach" width="90px" />
                       </row>
                  </rows>
        </grid>

i try some kind of this. but it doesn't work.

         for (Rows r: attachRows) {
            for (Component component : r.getChildren()) {
                Row row = (Row) component;
                row.appendChild(new Label("hello"));

                r.appendChild(row);
            }
        }

any idea how? please

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-12-13 06:25:11 +0800

jj gravatar image jj
638 3

You need to create a new row then append it to rows as a child

   Row r = new Row();
 r.appendChild(new Label("hello");
r.appendChild.....

attachRows.appendChild(r);

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-12-13 04:10:11 +0800

Seen: 80 times

Last updated: Dec 13 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More