BUG Fix side-by-side initial icon display issue in IE8.

The new 'liszt:ready' handler is called late enough to trigger the
update, whereas the redraw is called to early for IE8 to pick up the
class change. The class property is changed correcly though, it looks
like an IE8 rendering issue.

http://open.silverstripe.org/ticket/8095
This commit is contained in:
Mateusz Uzdowski 2012-12-16 15:53:22 +13:00
parent 8455686c36
commit bf5590d873

View File

@ -424,6 +424,7 @@
* Reacts to the user changing the preview mode.
*/
onchange: function(e) {
this._super(e);
e.preventDefault();
var targetStateName = $(this).val();
@ -523,38 +524,36 @@
'onliszt:showing_dropdown': function() {
this.siblings().find('.chzn-drop').addClass('open')._alignRight();
},
'onliszt:hiding_dropdown': function() {
this.siblings().find('.chzn-drop').removeClass('open')._removeRightAlign();
},
},
/**
* Trigger additional initial icon update when the control is fully loaded.
* Solves an IE8 timing issue.
*/
'onliszt:ready': function() {
this._super();
this._addIcon();
},
_addIcon: function(){
var selected = this.find(':selected');
var iconClass = selected.attr('data-icon');
var target = this.parent().find('.chzn-container a.chzn-single');
var oldIcon = target.attr('data-icon');
if(oldIcon != undefined){
if(typeof oldIcon !== 'undefined'){
target.removeClass(oldIcon);
}
target.addClass(iconClass);
target.attr('data-icon', iconClass);
return this;
}
});
/*
* When chzn initiated run select addIcon
* Apply description text if applicable
*/
$('.preview-selector a.chzn-single').entwine({
onmatch: function() {
this.closest('.preview-selector').find('select')._addIcon();
this._super();
},
onunmatch: function() {
this._super();
}
});
$('.preview-selector .chzn-drop').entwine({
_alignRight: function(){
var that = this;