template with parameters

how can I insert dynamic parameters in this instance:
view: "template", scroll:"y", src: "data/show_layout.php?idprogetto=" ?????,

the parameter I need is (id) which comes from here:
$$("Uploader").bind($$("list"), function(slave, master){
if (!master) return false;
return master.id == slave.id_progetto;
});
Thanks

Comments

  • Hello @lucianotrinca,

    You can dynamically redefine the src property at any point during the code execution via the define() method. The end result would look something like this:

    $$("Uploader").bind($$("list"), function(slave, master){
      if (!master) return false;
      $$("template").define({
        src:  "data/show_layout.php?idprogetto=${master.id}"
      })
      return master.id == slave.id_progetto;
    });
    

    Here is a small isolated example showcasing the dynamic property change: https://snippet.webix.com/v1fi2ts6.

  • thanks Dzmitry

  • Hi Dzmitry, I want to insert a svg element that functions as a button inside a template and when I click on it another element in the same template changes contents. example:
    var layout = {
    cols: [
    {template: "col 1"},
    {id: "a1", template: "column 1", width: 150},
    {view: "template", scroll: "y", template: "data / rectangles.svg", onClick: {"sx": function (e, id) {
    webix.message ("replace an image in template col 1");
    }
    }},
    ]

    };
      Thank you

  • Hello @lucianotrinca ,
    You can redefine template dynamically through:
    $$("t1").config.template = function(){...};
    Please check the following snippet:
    https://snippet.webix.com/q6aecw6j

  • great!! perfect thanks. I have to ask you another question.
    In column 1 I have two images sx_big and dx_big and in the third column on the right I have two images which are called sx and dx and each one must replace the corresponding one in the first column.
    After being replaced, the two images of the first column must allow with a drag and drop from an element of a list to associate their value (the original one of the image we dragged from the third column) with the value of the element of the list.
    for example: a list contains names and I want each name to be dynamically associated with the image of the first column.
    forgive the complexity of my question. if needed I can send you a diagram.
    thanks for your availability and patience.
    Luciano

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!