[DE ios] Fixed display table styles.
This commit is contained in:
parent
f0562c554d
commit
58534c42c3
|
@ -156,7 +156,7 @@ define([
|
||||||
// API handlers
|
// API handlers
|
||||||
|
|
||||||
onApiInitTemplates: function(templates) {
|
onApiInitTemplates: function(templates) {
|
||||||
_styles = [];
|
if (_styles.length < 1) {
|
||||||
_.each(templates, function(template){
|
_.each(templates, function(template){
|
||||||
_styles.push({
|
_styles.push({
|
||||||
imageUrl : template.get_Image(),
|
imageUrl : template.get_Image(),
|
||||||
|
@ -164,8 +164,8 @@ define([
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Common.SharedSettings.set('tablestyles', _styles);
|
this.getView('AddTable').render();
|
||||||
Common.NotificationCenter.trigger('tablestyles:load', _styles);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
textTableSize: 'Table Size',
|
textTableSize: 'Table Size',
|
||||||
|
|
|
@ -111,6 +111,7 @@ define([
|
||||||
me.api = api;
|
me.api = api;
|
||||||
|
|
||||||
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onApiFocusObject, me));
|
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onApiFocusObject, me));
|
||||||
|
me.api.asc_registerCallback('asc_onInitTableTemplates', _.bind(me.onApiInitTemplates, me));
|
||||||
},
|
},
|
||||||
|
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
|
@ -613,6 +614,19 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onApiInitTemplates: function(templates) {
|
||||||
|
var styles = [];
|
||||||
|
|
||||||
|
_.each(templates, function(template){
|
||||||
|
styles.push({
|
||||||
|
imageUrl : template.get_Image(),
|
||||||
|
templateId : template.get_Id()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getView('EditTable').updateStyles(styles);
|
||||||
|
},
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
_closeIfNeed: function () {
|
_closeIfNeed: function () {
|
||||||
|
|
|
@ -61,7 +61,6 @@ define([
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
|
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
|
||||||
Common.NotificationCenter.on('tablestyles:load', _.bind(this.render, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
|
@ -75,10 +74,10 @@ define([
|
||||||
this.layout = $('<div/>').append(this.template({
|
this.layout = $('<div/>').append(this.template({
|
||||||
android : Common.SharedSettings.get('android'),
|
android : Common.SharedSettings.get('android'),
|
||||||
phone : Common.SharedSettings.get('phone'),
|
phone : Common.SharedSettings.get('phone'),
|
||||||
styles : Common.SharedSettings.get('tablestyles')
|
styles : DE.getController('AddTable').getStyles()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var $tableStyles = $('.table-styles');
|
var $tableStyles = $('.container-add .table-styles');
|
||||||
if ($tableStyles) {
|
if ($tableStyles) {
|
||||||
$tableStyles.replaceWith(this.layout.find('#add-table-root').html());
|
$tableStyles.replaceWith(this.layout.find('#add-table-root').html());
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@ define([
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
||||||
Common.NotificationCenter.on('editcategory:show', _.bind(this.categoryShow, this));
|
Common.NotificationCenter.on('editcategory:show', _.bind(this.categoryShow, this));
|
||||||
Common.NotificationCenter.on('tablestyles:load', _.bind(this.onStylesLoad, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
|
@ -108,15 +107,15 @@ define([
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
|
|
||||||
onStylesLoad: function () {
|
updateStyles: function (styles) {
|
||||||
_styles = Common.SharedSettings.get('tablestyles');
|
_styles = styles;
|
||||||
|
this.renderStyles();
|
||||||
},
|
},
|
||||||
|
|
||||||
renderStyles: function() {
|
renderStyles: function() {
|
||||||
var $editTableStyle = $('#edit-table-styles .item-inner .dataview.table-styles'),
|
var $styleContainer = $('#edit-table-styles .item-inner');
|
||||||
$styleContainer = $('#edit-table-styles .item-inner');
|
|
||||||
|
|
||||||
if ($editTableStyle.length < 1 && $styleContainer.length > 0) {
|
if ($styleContainer.length > 0) {
|
||||||
var columns = parseInt($styleContainer.width() / 70), // magic
|
var columns = parseInt($styleContainer.width() / 70), // magic
|
||||||
row = -1,
|
row = -1,
|
||||||
styles = [];
|
styles = [];
|
||||||
|
|
Loading…
Reference in a new issue