Rows getting added before the layout

Hi

i have a webix code like this

webix.ui({

	view:"window",

	id:"moviewin",

	height:300,

	width:700,

	modal:true,

	position:"center",

	head:"Movie data",

	hidden: false, 

		body:{

			view:"form",id:"movieform",width:600, scroll: true, 

				 elements:[{

					view: "layout",

						cols:[

							{

                              view:"combo",

                              id:"moviedata",

                              label:"Fields",

								options:[

									{id:"movie",value:"Movie Name",type:"string"},

									{ id:"movieplace", value:"Movie Place", type:"string"},

									{ id:"year", alue:"year", type:"string" },

								],

							},

						{

                          view:"text",

                          label:"Value"

                        },

		]

  },

	{

      cols:[

		{view:"button",

         label:"Movie Data",

         	click:function(){


   }},

		{view:"button", 

         label:"Reset",

         	click:function(){

	}},

		{view:"button", 

         label:"Cancel",

         	click:function(){


          }},
        {view:"button", 

         label:"Add",

         	click:function(){

				$$("movieform").addView({

					view: "layout",

						cols:[	

							{

                              view:"combo",

                              id:"moviedata",

                              label:"Fields",

								options:[

									{id:"movie",value:"Movie Name",type:"string"},

									{ id:"movieplace", value:"Movie Place", type:"string"},

									{ id:"year", alue:"year", type:"string" },

								],

							},

						{

                          view:"text",

                          label:"Value"

                        },

						{view:"icon", icon:"wxi-trash",click:function(){

           			      let toRemove = this.getParentView();

                          this.getParentView().getParentView().removeView(toRemove)

      					}}, 

						]},1);

              
          }},

        ]

	}

 ],

}

});

Initially we have a combo and textbox.

When we click on the add button a combo and textbox are getting added.

But when i click on the second time the add button the combo and textbox are getting added before to the previous combo and textbox

I want to add the combo and text box after . How can i do that?

=============Click one ============
combo and textbox
combo1 and textbox1

===========click two===============
combo and textbox
combo2 and textbox2
combo1 and textbox1

***Expected Output
=========Click one ==============
combo and textbox
combo1 and textbox1

===========click two===============
combo and textbox
combo1 and textbox1
combo2 and textbox2

===========click three===============
combo and textbox
combo1 and textbox1
combo2 and textbox2
combo3 and textbox3

Hi,

Can some one please help me out.

I changed the position in the addview to 2…

But how can i do this dynamically?

Hello,

Please check the sample: https://snippet.webix.com/jdkosykt

@Nastja

Thank you for the reponse .

But still when i click on the add button for the second time the row is getting added in the middle . I wanted to add it last.

@Natsja

The problem is that every time when i click on the add button the combo and the textbox should be added last.

Instead the combo and textbox are getting added in the middle when i click on the add button for the third and the fourth time.

Please help me how can i do this?

Give me, please, some clarification: do you want to add rows below the buttons?

@Nastja

Hi,

Initially only the combo and textbox will be displayed.

Lets say the displayed row which contains combo and textbox is row1

Now when you click on the add button for the first time below one more row say row2 gets added which contains combo and textbox.

now select the movie name and add some text in the textbox .

Until this is fine

Now click on the add button

Row3 is getting added below the row1 and above row2 which is not the expected behaviour.

Row3 should be added after row2 and above the buttons…

How can i do this?

It’s because of the index
https://snippet.webix.com/i59r9e0k

@Nastja

Thanks a lot :smile: :blush: