Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when implement quicksearch on a multiselect an additional button select appears #40

Open
jaredshito opened this issue Jul 26, 2018 · 3 comments
Labels

Comments

@jaredshito
Copy link

jaredshito commented Jul 26, 2018

i implement your library in a multiselect , but i see up my inputs a button select that says nothing selected(sorry for my inglish btw)

captura de pantalla 178

html:

<div class="selector">
		<div class="row">
			<h2 class="card-inside-title">Estudios</h2>
			<select id="estudios" class="searchable" name="estudios[]" multiple="multiple">
				<?
					foreach($tipoestudios as $tipoestudio)
					{
						echo '<optgroup label="'.$tipoestudio->nombre.'">';
						
							$catestudios = $this->m_estudios->obt_CatEstudios($tipoestudio->id);
							
							foreach($catestudios as $catestudio)
							{
								echo '<option value="'.$catestudio->id.'">'.$catestudio->nombre.'</option>';
							}
							
						echo '</optgroup>';
					}
				?>
				
			</select>
		</div>
	</div>

javascript:

<script type="text/javascript">
$(document).ready(function() {
$('#estudios').multiSelect({

selectableOptgroup: true,
selectableHeader: "<input type='text' size='30 px' class='search-input' autocomplete='on'               placeholder='buscar'>",
selectionHeader: "<input type='text' class='search-input' autocomplete='on' placeholder='buscar'>",
afterInit: function(ms){

    var that = this,

    $selectableSearch = that.$selectableUl.prev(),
    $selectionSearch = that.$selectionUl.prev(),
    selectableSearchString = '#'+that.$container.attr('id')+'  .ms-elem-selectable:not(.ms-selected)',
    selectionSearchString = '#'+that.$container.attr('id')+' .ms-elem-selection.ms-selected';

    that.qs1 = $selectableSearch.quicksearch(selectableSearchString,{
               'show': function () {

                    $(this).prev(".ms-optgroup-label").show();
                    $(this).show();
                },
                'hide': function () {
                    $(this).prev(".ms-optgroup-label").hide();
                    $(this).hide();
                }
    })
    .on('keydown', function(e){
      if (e.which === 40){
        that.$selectableUl.focus();
        return false;
      }
    });

    that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
    .on('keydown', function(e){
      if (e.which == 40){
        that.$selectionUl.focus();
        return false;
      }
    });
},afterSelect: function(){
  this.qs1.cache();
  this.qs2.cache();
},
afterDeselect: function(){
  this.qs1.cache();
  this.qs2.cache();

}
});
});

</script>
@nitriques
Copy link
Member

Hi! Can you rephrase your problem ?

Also, (unrelated to your post), your php seems to be vulnerable to xss injection. You might want to call htmlspecialchars() on the values you output with echo.

@jaredshito
Copy link
Author

jaredshito commented Aug 2, 2018

well i was following this issue riklomas/quicksearch#72 , in that issue nckenn put the script that im ussing , but the problem is when i implement that code the botton select appears in my page but in any part i put it , i think the quicksearch labrary do that, becouse when i dont use it my quicksearch looks ok

without quicksearch

@jaredshito jaredshito changed the title button dropdown show up to inputs when implement quicksear on a multiselct a additional button select appears Aug 2, 2018
@jaredshito jaredshito changed the title when implement quicksear on a multiselct a additional button select appears when implement quicksearch on a multiselect a additional button select appears Aug 2, 2018
@jaredshito jaredshito changed the title when implement quicksearch on a multiselect a additional button select appears when implement quicksearch on a multiselect an additional button select appears Aug 2, 2018
@nitriques
Copy link
Member

Can you show a with/without screenshot ? Because I still do not get where is the problem.

¿intentar en español?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants