SAPUI5 изменить JSON-файл
Я создал файл json config.json и расширенный класс json для управления этим файлом json.
В основном я хотел бы прочитать и обновить этот файл.
Читать:
init : function(fnSuccess, scope) {
this.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);
this.loadData("conf.json");
this.attachRequestCompleted(function() {
window.url = this.getProperty("/config/url");
window.port = this.getProperty("/config/port");
window.ldap = this.getProperty("/config/ldap");
if(typeof fnSuccess === 'function')
fnSuccess(scope);
});
},
Работало нормально!
Теперь, чтобы обновить файл:
save: function(url, port, ldap){
if(url != null)
this.setProperty("/config/url", url);
if(port != null)
this.setProperty("/config/port", port);
if(ldap != null)
this.setProperty("/config/ldap", ldap);
console.log(this.getJSON());
}
console.log(this.getJSON())
распечатайте мою измененную модель JSON, но при перезагрузке или открытии файла conf.json ничего не изменилось!
Возможно ли это сделать?
Благодарю.