Bind ForestDisplay to initial data
This commit is contained in:
parent
31b742fdb7
commit
c12c705f8b
3 changed files with 6 additions and 11 deletions
|
@ -40,7 +40,7 @@ class KHistory {
|
|||
templates['opegroup'] =
|
||||
'<div class="opegroup"><span class="time"></span><span class="amount"></span><span class="valid_by"></span><span class="comment"></span></div>';
|
||||
|
||||
this.display = new ForestDisplay(this._$container, templates);
|
||||
this.display = new ForestDisplay(this._$container, templates, this.data);
|
||||
|
||||
this._init_events();
|
||||
}
|
||||
|
|
|
@ -1267,10 +1267,10 @@ class OperationList extends APIModelForest {
|
|||
|
||||
class ForestDisplay {
|
||||
|
||||
constructor($container, templates) {
|
||||
constructor($container, templates, data) {
|
||||
this._templates = templates ;
|
||||
this._$container = $container;
|
||||
this.data = new ModelForest();
|
||||
this.data = data || new ModelForest();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1341,15 +1341,10 @@ class ForestDisplay {
|
|||
|
||||
|
||||
/**
|
||||
* Updates stored data and displays it in container.
|
||||
* @param {Models.ModelForest} data
|
||||
* Displays stored data in container.
|
||||
* @param {Object} [options] Options for element render method
|
||||
*/
|
||||
render(data, options) {
|
||||
if (data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
render(options) {
|
||||
var forest = this.data ;
|
||||
|
||||
if (forest.is_empty())
|
||||
|
|
|
@ -434,7 +434,7 @@ class ArticleManager {
|
|||
'category': '<div class="category"><span class="name"></span></div>',
|
||||
'article' : '<div class="article"><span class="name"></span><span class="price"></span><span class="stock"></span></div>'
|
||||
} ;
|
||||
this.display = new ForestDisplay($container, templates);
|
||||
this.display = new ForestDisplay($container, templates, this.data);
|
||||
this.autocomplete = new ArticleAutocomplete(this, $container);
|
||||
|
||||
this._init_events();
|
||||
|
|
Loading…
Reference in a new issue