loading views dynamically

edited July 2017 in General

Hello,

i want to to load up to 5 times 3 different views between other views depending on an combo change its values.
One of this 3 views contains a label, a counter and a text field in one row.
The label,counter, and text values come from a controller. So webix doesnt know how many of the max 5 times come from the controller. The JSON from the controller looks like {[id:182781,name:"name1",recnbr:23,counter:2,text:"bla"]}
so: label gets name value, counter gets counter value, text gets text value. i want to store the id in a hidden view in each row.If the json is empty all of the 5 lines should appear .

i found this : https://webix.com/snippet/a67cdb15 and
https://docs.webix.com/desktop__html_markup_init.html for an other way
but this doesnt help.

Any idea?Thx!

Comments

  • edited July 2017

    ok, got it:

    function addWebixView(name,counter,text,recnbr,index){

        $$("layout").addView({
                type: "line",id:"LINE".concat(index), cols: [{
                    view: "label",
                    label: name,
                    id: "labelText".concat(index),
                    width: 200,
                    css:"bold"
                },
                    {view: "spacer", width: 20,id:"spaceFirst".concat(index)},
                    {view: "counter", id:"counter".concat(index),value: counter,width: 150, css: "man_style"},
                    {
                        label: "Track",
                        view: "text",
                        id: "text".concat(index),
                        value:text,
                        labelWidth: 170
                    },
                    {
                        view: "text",
                        hidden:"true",
                        id: "texthidden".concat(index),
                        value:recnbr
                    }
                ]
            },
            -1);
    
        $$("layout").addView({view: "spacer", height: 20,id:"spaceSecond".concat(index)}, -1);
    }
    

    and i call the function onChange on a combo ...works fine;-).."layout" is the ID of the ui.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion