Sumo select - how to make the listbox be loaded always open?

1.6k Views Asked by At

enter image deslist boxn here

how to make the listbox be loaded always open? Like user click?

2

There are 2 best solutions below

2
On BEST ANSWER

You could simply add the class open to the sumo element like :

$('.SumoSelect').addClass('open');

Or base on your select selector like :

$('you_select_selector').parent().find('.optWrapper.multiple').addClass('open');

$('#island').SumoSelect({
  placeholder: "TestPlaceholder"
});

$('.SumoSelect').addClass('open');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdn.rawgit.com/HemantNegi/jquery.sumoselect/6c94c948/sumoselect.css" rel="stylesheet" />
<script src="https://cdn.rawgit.com/HemantNegi/jquery.sumoselect/master/jquery.sumoselect.js"></script>

<select id="island" multiple class="test">
  <option value="Big Island">Big Island</option>
  <option value="Oahu">Oahu</option>
  <option value="Kauai">Kauai</option>
  <option value="Maui">Maui</option>
</select>

0
On

I'm having problems, after I added the option: jQuery ('. SumoSelect'). addClass ('open'); The asp: listbox is always open as expected, but when the user clicks on an item in the list, it does not select (does not select any item), other than the example you put above

My code:

<script src="/js/Alex/jquery.sumoselect.min.js" type="text/javascript"></script>

      <script type="text/javascript">
             jQuery(document).ready(function () {
                jQuery(<%=lstBoxClientes.ClientID%>).SumoSelect({ search: true, searchText: 'Pesquise...' });                                                              jQuery('.SumoSelect').addClass('open');
                  });                                                 
      </script>        


  <asp:listbox runat="server" id="lstBoxClientes" selectionmode="single" DataSourceID="dsclientes" 
    DataTextField="cliente"  DataValueField="clienteid">
      </asp:listbox>