AnsweredAssumed Answered

Reload the HBS after custom loadData

Question asked by Faye Business Systems Group Developers on Aug 28, 2017
Latest reply on Aug 31, 2017 by Eugene Bychkov

Hi Team,

 

We have a custom view that has to load some data in the loadData (or wherever it's appropriate) from ajax calls.  After that we need to re-render the hbs with the data received from the ajax call. 

 

Also we are fetching a bean in the init but can't get the loaded data into the hbs. 

 

/code 

 

module.exports = customization.extend(NomadView, {
template: app.template.get('fbsglocator-radius-view'),

events() {
return {
'click button': this._onActionClick,
};
},

headerConfig: {
title: app.lang.get('FBSG Locator'),
buttons: {
mainMenu: true,
},
},

// Any header button has a handler function which can be used.
// Here, we want to show an alert when a user clicks Save button.
onHeaderSaveClick() {
dialog.showAlert('Custom Save button handler');
this._super();
},

initialize(options) {
console.log('fbsglocator-radius-view', options);
this.mapData = options.data;
let data = options.data || {};
this.something = 'Something';
this.parentRecord = app.data.createBean(this.mapData.module, {id: this.mapData.recordID});
this.parentRecord.fetch();
$('#fbsglocator-recordname').html('something');

this._super(options);
},

loadData() {
// custom data loading method.
$.ajax({
'type': 'GET',
success: function(data){
console.log(data);
//somehow render the hbs
}
});
},

Outcomes