EasyUI Forum
May 07, 2024, 03:44:40 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Hide/Show a DataList  (Read 10738 times)
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« on: July 23, 2015, 01:33:51 PM »

I have a DataList inside a accordion and after click a checkbox I want to show the datalist.
Initially, i specify display :none to hide the datalist, so :
Code:
               <div id='especialidadList'
                        class="easyui-datalist"
                        title="Especialidades"
                        style="width:400px; height:200px; display:none"
                        data-options="
                        fit : true,
                        lines : true,
                        checkbox: true,
                        url: './plan/crud_plan.php?action=FC',
                        valueField  : 'id_especialidad',
                        textField   : 'nb_especialidad',
                        selectOnCheck: false,
                        onBeforeSelect: function(){return false;}">
                </div>

When i run my app, the datalist is shown!!!
Also i add the change event code for the checkbox and add this code

Code:
      if (this.checked) {
                $('#cboEspecialidad').prop('disabled', false);
                $('#especialidadList').show();
            } else {
                $('#cboEspecialidad').prop('disabled', 'disabled');
                $('#especialidadList').hide();
            }
 


But 'especialidadList' (the datalist) does not set hide/show

TIA,
Yamil
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 23, 2015, 07:31:01 PM »

To show or hide the datalist, you must get the panel object first and then call 'open' or 'close' method.
Code:
var p = $('#especialidadList').datalist('getPanel');
p.panel('close');  // hide the datalist panel
p.panel('open');  // open the datalist panel
Logged
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« Reply #2 on: July 24, 2015, 03:13:35 PM »

Thanks a lot!!!!
Logged
battlezad
Newbie
*
Posts: 44


View Profile
« Reply #3 on: July 28, 2015, 02:26:37 AM »

This also helped me, thank you Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!