EasyUI Forum
May 16, 2024, 03:36:15 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Hope there is an option for combobox to show checkbox  (Read 10770 times)
lyz19890927
Newbie
*
Posts: 1


View Profile Email
« on: August 14, 2012, 06:18:18 PM »

I think right now this hasn't been offered yet. Is there other way to achieve?

Just like combotree,if we can see the checkboxes ,it will be much clearer when users choose.

In combotree,the Property 'onlyLeafCheck' works when I set 'multiple : true, checkbox : true', hope it works too when I set ''multiple : false, checkbox : true', i.e. single select.

Another question , in datagrid we have the handler onSortColumn now . But I couldn't stop the sort action by it.Hope give some tip. Many thanks!
« Last Edit: August 14, 2012, 06:21:59 PM by lyz19890927 » Logged
Andy1980
Newbie
*
Posts: 14


View Profile Email
« Reply #1 on: November 15, 2013, 08:05:35 AM »

Hi,

you can easy achieve this with the normal combo like that:

Code:
	<select id="cc2" style="width:150px"></select>
    <div id="sp">
        <div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>
        <input type="checkbox" name="lang" value="01"><span>Java</span><br/>
        <input type="checkbox" name="lang" value="02"><span>C#</span><br/>
        <input type="checkbox" name="lang" value="03"><span>Ruby</span><br/>
        <input type="checkbox" name="lang" value="04"><span>Basic</span><br/>
        <input type="checkbox" name="lang" value="05"><span>Fortran</span>
    </div>

Code:
            $('#cc2').combo({
                required:true,
                editable:false,
multiple:true
            });
           $('#sp').appendTo($('#cc2').combo('panel'));
           $('#sp input').click(function(){
var my_text = '';
var my_val = '';
   
$('#sp input').each(function(){
if ($(this).is(":checked")) {
var v = $(this).val();
var s = $(this).next('span').text();

my_text == '' ? my_text = s : my_text += ','+s;
my_val  == '' ? my_val = v : my_val += ','+v;
}
});

$('#cc2').combo('setValue', my_val).combo('setText', my_text);
            });
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!