I am trying to dynamically update a widget’s content after an “event” and date are selected in a popup attached to the same widget. I am currently storing all user data in an array of JSON objects that is then supposed to be displayed to the user in a template field in the parent widget. I have tried following the example found in the Webix documentation for adding JSON object to a widget, but that method did not work for me. Any help is greatly appreciated! Below is the current code I have:
//the events JSON array is located in another file
function loadCalendar(){
//Create the calendar widget
webix.ui({
container:"calendar",
id: "calendar1",
autoConfig: true,
view:"window",
head:{
cols:[
{view: "label", label: dd},
{view:"icon", icon:"plus", popup: "add_event"},
{view:"icon", icon:"minus"}
]
},
body: {
view:"template",
id: "event_space",
template: "",
data: events
},
width: "auto",
height: "auto"
}).show();
}
webix.ui({
view:"popup",
id: "add_event",
head: "Add event",
width:300, height:200,
body:{
view: "form",
scroll:false,
elements:[
{view:"text", name:"event", id:"event", label:"Event: "},
{view:"datepicker", label:"Event date:", name:"e_date", id:"e_date", stringResult:true },
{ view:"button", type:"form", value:"Add Event", click: function(){
//This is where the parent widget's content should be updated.
events.push(JSON.stringify(this.getParentView().getValues(),0,1));
window.alert(events);
$$('add_event').hide();
}}
]
}
});