Doubt about the use of Chosen-select

Asked

Viewed 95 times

0

Good morning

Staff I’m using the Chosen-select in my project of the following link: Link to the Chosen Project

Good so far no news, however in my project I have a file sysfly.php (page that already has a Chosen-select working) and I have another call sysflyajax.php(in that I have some routines to popular a div of sysfly.php.

In sysflyajax.php i have a select that prentendo using the Chosen-select, but when I put it in the class of that select it is not displayed, when I take the reference of the Chosen-select form-control he is displayed.

I noticed the following when I put Chosen-select form-control in the archive sysfly.php he does the following:

<select id="EntFilterZ2" name="EntFilters2[]" multiple="" class="col-xs-12 col-sm-12 chosen-select form-control" data-placeholder="Selecione os filtros desejados" style="display: none;">
                <option>eder</option>
                <option>luca</option>
                <option>luiz</option>
            </select>

<div class="chosen-container chosen-container-multi" title="" id="EntFilterZ2_chosen" style="width: 998px;"><ul class="chosen-choices">
  <li class="search-field">
    <input class="chosen-search-input default" type="text" id="inpFilter" autocomplete="off" value="Selecione os filtros desejados" style="width: 2px;">
  </li>
</ul>
<div class="chosen-drop">
  <ul class="chosen-results"></ul>
</div></div>

In my own code I actually created the select lines but automatically it mounted other elements as shown above .

But in my select I rode inside the file sysflyajax.php it does not mount the other lines automatically so it does not work.

Could anyone tell me why this behavior? Just to be clear on sysflyajax.php is the place where I use php to search for information in the mysql database and select which I will use Chosen-select is stored in a variable, but as said if I use Chosen-select in the class select is not displayed.

Unfortunately I can not post the code of the pages since it is a system of a client and I can not disclose the same, I needed to understand why this behavior .

1 answer

0

Good morning

Answering my question to solve my problem just put in a javascript function I put the following command:

$('.Chosen-select'). Chosen({ width: '100%' }); $('. Chosen-select-deselect'). Chosen({ allow_single_deselect: true });

Where solved my problem in definitive thank you to all.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.