Setting value in daughter page widget from master page

Hello,

Please kindly help me with the following issue.

One application page contains a datatable widget. This table includes the following column:

{id:"edit", header:" ", width:35, 
template:"<span style='cursor:pointer;' class='webix_icon fa-pencil'></span>"}

This is the fa-pencil edit capability present in several demo examples.

The event handler then is:

onClick:
{
        "fa-pencil":function(e,id,node)
        {              
                var mynewpage = this.$scope.ui(some_nice_page.$ui);
                mynewpage.show();
        }
}

Here I create a new page called some_nice_page. This some_nice_page contains various widgets including a few “text” fields widgets.

I want to populate these text fields with data from the main page and I want to do this from the main page in the fa-pencil event handler. I have tried many ways including for example this (as seen above too):

mynewpage.setValue({"prod_name_id":"apples"});

to try and set the “text” field named “prod_name_id” to the text value “apples”. This does not work so I am probably not understanding the concepts correctly here. Please kindly provide some guidance on how this should be done. I am learning as I progress with development.

Thanks in advance!
Johan

ps: Not sure my code snipplets above will show up correctly. Doesn’t look right in the preview…

Sorry, as suspected the example code doesn’t show up properly. But I think you will understand my issue anyway. Johan

Hi,

As far as I see, you initialize a ‘some_nice_page’ in a window, am I right?

If so, window does not feature setValue method, but the form has a similar one. You need to create a form inside the window and define name properties for the needed controls:

view:"window", body:{
   view:"form",
   elements:[
     {view:"text", name:"prod_name_id" }
   ]
}

Then it will be possible to populate the form as

mynewpage.getBody().SetValues({"prod_name_id":"apples"})

As to the code formatting, you can wrap it into ~~~js /code/ ~~~ marks.