From aee74f91b46df9425caa47cff3cdb947df7a17f9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 18 Sep 2018 16:22:30 +0300 Subject: [PATCH] Optimize dataview rendering --- apps/common/main/lib/component/DataView.js | 2 +- apps/common/main/lib/component/ListView.js | 2 +- apps/common/main/lib/component/TreeView.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 07b629f58..d343f62ac 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -424,7 +424,7 @@ define([ innerEl.prepend(view.render().el); else innerEl.append(view.render().el); - innerEl.find('.empty-text').remove(); + (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); var idx = _.indexOf(this.store.models, record); this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx)); diff --git a/apps/common/main/lib/component/ListView.js b/apps/common/main/lib/component/ListView.js index 1476af029..c23f24473 100644 --- a/apps/common/main/lib/component/ListView.js +++ b/apps/common/main/lib/component/ListView.js @@ -77,7 +77,7 @@ define([ this.innerEl = $(this.el).find('.inner'); if (view && this.innerEl) { - this.innerEl.find('.empty-text').remove(); + (this.dataViewItems.length<1) && this.innerEl.find('.empty-text').remove(); if (this.options.simpleAddMode) { this.innerEl.append(view.render().el); this.dataViewItems.push(view); diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index 1eb299f1b..fb5b001d3 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -195,7 +195,7 @@ define([ if (view) { var innerEl = $(this.el).find('.inner').addBack().filter('.inner'); if (innerEl) { - innerEl.find('.empty-text').remove(); + (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); if (opts && opts.at!==undefined) { var idx = opts.at;