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'] =
|
templates['opegroup'] =
|
||||||
'<div class="opegroup"><span class="time"></span><span class="amount"></span><span class="valid_by"></span><span class="comment"></span></div>';
|
'<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();
|
this._init_events();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1267,10 +1267,10 @@ class OperationList extends APIModelForest {
|
||||||
|
|
||||||
class ForestDisplay {
|
class ForestDisplay {
|
||||||
|
|
||||||
constructor($container, templates) {
|
constructor($container, templates, data) {
|
||||||
this._templates = templates ;
|
this._templates = templates ;
|
||||||
this._$container = $container;
|
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.
|
* Displays stored data in container.
|
||||||
* @param {Models.ModelForest} data
|
|
||||||
* @param {Object} [options] Options for element render method
|
* @param {Object} [options] Options for element render method
|
||||||
*/
|
*/
|
||||||
render(data, options) {
|
render(options) {
|
||||||
if (data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
var forest = this.data ;
|
var forest = this.data ;
|
||||||
|
|
||||||
if (forest.is_empty())
|
if (forest.is_empty())
|
||||||
|
|
|
@ -434,7 +434,7 @@ class ArticleManager {
|
||||||
'category': '<div class="category"><span class="name"></span></div>',
|
'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>'
|
'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.autocomplete = new ArticleAutocomplete(this, $container);
|
||||||
|
|
||||||
this._init_events();
|
this._init_events();
|
||||||
|
|
Loading…
Add table
Reference in a new issue