From f1de22924c66172b9939f79d02e90402c520b73a Mon Sep 17 00:00:00 2001 From: idostern Date: Mon, 11 Nov 2013 10:29:04 +0200 Subject: [PATCH] restyle checkbox --- bootstrap-select.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bootstrap-select.js b/bootstrap-select.js index 5c97178b2..9de3282bf 100644 --- a/bootstrap-select.js +++ b/bootstrap-select.js @@ -94,7 +94,7 @@ //If we are multiple, then add the show-tick class by default var multiple = this.multiple ? ' show-tick' : ''; var header = this.options.header ? '
' + this.options.header + '
' : ''; - var selectAll = this.multiple? '
'+this.options.selectedAllText+'
' : ''; + var selectAll = this.multiple? '
'+this.options.selectedAllText+'
' : ''; var searchbox = this.options.liveSearch ? '' : ''; var drop = "
" + @@ -203,7 +203,7 @@ createA: function(text, classes, inline) { return '' + text + - '' + + '' + ''; }, @@ -445,6 +445,11 @@ setSelected: function(index, selected) { this.$menu.find('li').eq(index).toggleClass('selected', selected); + if(this.$menu.find('li').eq(index).hasClass('selected')){ + this.$menu.find('li').eq(index).find('.glyphicon').removeClass('glyphicon-unchecked').addClass('glyphicon-check'); + }else{ + this.$menu.find('li').eq(index).find('.glyphicon').removeClass('glyphicon-check').addClass('glyphicon-unchecked'); + } }, setDisabled: function(index, disabled) { @@ -535,7 +540,7 @@ } if(that.$selectAll){ that.$selectAll.removeClass('allSelected'); - that.$selectAll.find('.checker').hide(); + that.$selectAll.find('.glyphicon').removeClass('glyphicon-check').addClass('glyphicon-unchecked'); } } }); @@ -576,10 +581,10 @@ e.stopPropagation(); if(that.$selectAll.hasClass('allSelected')){ that.deselectAll(); - that.$selectAll.find('.checker').hide(); + that.$selectAll.find('.checker').removeClass('glyphicon-checke').addClass('glyphicon-unchecked'); }else{ that.selectAll(); - that.$selectAll.find('.checker').show(); + that.$selectAll.find('.checker').removeClass('glyphicon-unchecked').addClass('glyphicon-check'); } that.$selectAll.toggleClass('allSelected');