mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 05:39:10 +02:00
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:
parent
8455686c36
commit
bf5590d873
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user