Refactoring dataview component
This commit is contained in:
parent
28c082312a
commit
f872be81c9
|
@ -91,6 +91,7 @@ define([
|
|||
this.rendered = false;
|
||||
this.needFillComboView = false;
|
||||
this.minWidth = this.options.minWidth;
|
||||
this.delayRenderTips = this.options.delayRenderTips || false;
|
||||
|
||||
this.fieldPicker = new Common.UI.DataView({
|
||||
cls: 'field-picker',
|
||||
|
@ -102,7 +103,8 @@ define([
|
|||
'<span class="title"><%= title %></span>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join(''))
|
||||
].join('')),
|
||||
delayRenderTips: this.delayRenderTips
|
||||
});
|
||||
|
||||
this.openButton = new Common.UI.Button({
|
||||
|
@ -137,7 +139,8 @@ define([
|
|||
'<span class="title"><%= title %></span>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join(''))
|
||||
].join('')),
|
||||
delayRenderTips: this.delayRenderTips
|
||||
});
|
||||
|
||||
// Handle resize
|
||||
|
|
|
@ -272,6 +272,7 @@ define([
|
|||
me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true;
|
||||
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
|
||||
me.tabindex = me.options.tabindex || 0;
|
||||
me.delayRenderTips = me.options.delayRenderTips || false;
|
||||
if (me.parentMenu)
|
||||
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
|
||||
me.rendered = false;
|
||||
|
@ -454,14 +455,28 @@ define([
|
|||
var idx = _.indexOf(this.store.models, record);
|
||||
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
|
||||
|
||||
if (record.get('tip')) {
|
||||
var view_el = $(view.el);
|
||||
view_el.attr('data-toggle', 'tooltip');
|
||||
view_el.tooltip({
|
||||
title : record.get('tip'),
|
||||
placement : 'cursor',
|
||||
zIndex : this.tipZIndex
|
||||
});
|
||||
var me = this,
|
||||
view_el = $(view.el),
|
||||
tip = record.get('tip');
|
||||
if (tip) {
|
||||
if (this.delayRenderTips)
|
||||
view_el.one('mouseenter', function(){ // hide tooltip when mouse is over menu
|
||||
view_el.attr('data-toggle', 'tooltip');
|
||||
view_el.tooltip({
|
||||
title : tip,
|
||||
placement : 'cursor',
|
||||
zIndex : me.tipZIndex
|
||||
});
|
||||
view_el.mouseenter();
|
||||
});
|
||||
else {
|
||||
view_el.attr('data-toggle', 'tooltip');
|
||||
view_el.tooltip({
|
||||
title : tip,
|
||||
placement : 'cursor',
|
||||
zIndex : me.tipZIndex
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.listenTo(view, 'change', this.onChangeItem);
|
||||
|
|
|
@ -235,7 +235,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
dataHintOffset: 'big',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="item-icon-box" id="<%= id %>">',
|
||||
|
@ -274,7 +275,8 @@ define([
|
|||
restoreHeight: 465,
|
||||
groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),
|
||||
store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>')
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>'),
|
||||
delayRenderTips: true
|
||||
});
|
||||
});
|
||||
this.btnChartType.render($('#chart-button-type'));
|
||||
|
@ -444,7 +446,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
dataHintOffset: 'big',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbChartStyle.render($('#chart-combo-style'));
|
||||
this.cmbChartStyle.openButton.menu.cmpEl.css({
|
||||
|
|
|
@ -139,7 +139,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: '-10, 0'
|
||||
dataHintOffset: '-10, 0',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="item-icon-box" id="<%= id %>" style="">',
|
||||
|
|
|
@ -1586,7 +1586,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
dataHintOffset: 'big',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="item-icon-box" id="<%= id %>">',
|
||||
|
|
|
@ -754,7 +754,8 @@ define([
|
|||
groups: new Common.UI.DataViewGroupStore(),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="52" width="72"></div>'),
|
||||
style: 'max-height: 350px;'
|
||||
style: 'max-height: 350px;',
|
||||
delayRenderTips: true
|
||||
});
|
||||
});
|
||||
this.btnTableTemplate.render($('#table-btn-template'));
|
||||
|
|
|
@ -226,7 +226,8 @@ define([
|
|||
restoreHeight: 465,
|
||||
groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),
|
||||
store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>')
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>'),
|
||||
delayRenderTips: true
|
||||
});
|
||||
});
|
||||
this.btnChartType.render($('#chart-button-type'));
|
||||
|
@ -386,7 +387,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
dataHintOffset: 'big',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbChartStyle.render($('#chart-combo-style'));
|
||||
this.cmbChartStyle.openButton.menu.cmpEl.css({
|
||||
|
|
|
@ -695,7 +695,8 @@ define([
|
|||
groups: new Common.UI.DataViewGroupStore(),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="52" width="72"></div>'),
|
||||
style: 'max-height: 350px;'
|
||||
style: 'max-height: 350px;',
|
||||
delayRenderTips: true
|
||||
});
|
||||
});
|
||||
this.btnTableTemplate.render($('#table-btn-template'));
|
||||
|
|
|
@ -2021,7 +2021,8 @@ define([
|
|||
restoreHeight: 300,
|
||||
style: 'max-height: 300px;',
|
||||
store: me.getCollection('TableTemplates'),
|
||||
itemTemplate: _.template('<div class="item-template"><img src="<%= imageUrl %>" id="<%= id %>" style="width:60px;height:44px;"></div>')
|
||||
itemTemplate: _.template('<div class="item-template"><img src="<%= imageUrl %>" id="<%= id %>" style="width:60px;height:44px;"></div>'),
|
||||
delayRenderTips: true
|
||||
});
|
||||
|
||||
picker.on('item:click', function(picker, item, record) {
|
||||
|
|
|
@ -1001,7 +1001,8 @@ define([
|
|||
cls: 'combo-chart-style',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
dataHintOffset: 'big',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbChartStyle.render($('#chart-combo-style'));
|
||||
this.cmbChartStyle.openButton.menu.cmpEl.css({
|
||||
|
@ -1053,7 +1054,8 @@ define([
|
|||
itemHeight: 50,
|
||||
menuMaxHeight: 272,
|
||||
enableKeyEvents: true,
|
||||
cls: 'combo-spark-style'
|
||||
cls: 'combo-spark-style',
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.cmbSparkStyle.render($('#spark-combo-style'));
|
||||
this.cmbSparkStyle.openButton.menu.cmpEl.css({
|
||||
|
|
|
@ -178,7 +178,8 @@ define([
|
|||
'<span class="title"><%= title %></span>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join(''))
|
||||
].join('')),
|
||||
delayRenderTips: true
|
||||
});
|
||||
this.stylesList.on('item:select', _.bind(this.onSelectStyles, this));
|
||||
|
||||
|
|
|
@ -531,7 +531,8 @@ define([
|
|||
groups: new Common.UI.DataViewGroupStore(),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="44" width="60"></div>'),
|
||||
style: 'max-height: 325px;'
|
||||
style: 'max-height: 325px;',
|
||||
delayRenderTips: true
|
||||
});
|
||||
});
|
||||
this.btnTableTemplate.render($('#table-btn-template'));
|
||||
|
|
Loading…
Reference in a new issue