On selecting an item in the dataview I obtain the data with the following call
var item = webix.$$("Data").getItem(id);
and store this in status.js state.data
I then change view as follows this.$scope.show("data_edit");
In this view I have set the data for the view to state.data
data : state.data
This works just fine for the first item I enter the form.
When I exit the form and go back to the dataview and select another item to edit I end up with the previous data in the form
I have addressed this using onAfterLoad
onAfterLoad: function () {
webix.message('onAfterLoad editDetails');
this.setValues({ field1: state.data.field1 });
this.refresh();
},
I tried and I had through I could do the following
onAfterLoad: function () {
webix.message('onAfterLoad editDetails');
this.setValues({ data: state.data });
this.refresh();
},
That way I would not have to set each individual field, but this just didn’t work.
I also set complexData: true
properity in the form, no luck at all.
As I’m setting data in onAfterLoad I thought I might not need set data in the form but I do.
My question is, is this the correct way to do this. I would prefer to just set data to state.data as follows, its clean and when I save the data I will have the whole item.
onAfterLoad: function () {
this.setValues({ data: state.data });
this.refresh();
},
Any suggestions would be much appreciated.