combobox组件

一、禁用combobox里面的输入框

$("选择器").combo('textbox').attr("readonly", "readonly");
$('选择器').combobox({

  editable:false ,
    panelheight:300
});

 

二、禁用

  $('选择器').combobox('disable');

 

三、获取选项文本和值

$("选择器").combobox("getText")//获取选项文本

$("选择器").combobox("getValue")//获取选项值

四、聚焦自动展开,回车do someting

EasyUI使用技巧总结
$("选择器").focus(function () {
    $(this).combo('showPanel');
    $(this).combo('textbox').focus();
    $($(this).combo('textbox')).unbind("keyup").bind("keyup", function (e) {
        if (e.keyCode == 13) {

            //do someting
        }
    });
});
EasyUI使用技巧总结

 

 

二、弹出层弹出时默认第一个按钮有焦点按回车键可以执行相应函数后关闭,但在cs程序中使用webbrowser显示后不可用了。

所以有了下面方法,监听body  keyup事件,不同的是按钮有没焦点都能激发点击事件,这样也更像模态窗口。(此方法如果在弹出窗口中操作按回车会关闭,不可取)

EasyUI使用技巧总结
 1 $('body').live('keyup',function(e){
 2     if(e.keyCode == 13){
 3 
 4         $('.window').map(function(){
 5 
 6             if($(this).css('display') == 'block'){
 7                 $(this).find('.messager-button').children("a:first").click();
 8                 $(this).find('.dialog-button').children("a:first").click();
 9             }
10         
11         });
12 
13     }
14 });
EasyUI使用技巧总结

 

注:看到很多园友写相关文章,也用上了,感觉上了贼船,好慢。页面加载时有两秒左右全白(只是引用库文件),那么多人用性能应该还可以吧。望大牛指点一二。

相关文章:

  • 2022-01-15
  • 2021-11-20
  • 2021-09-26
  • 2021-10-28
  • 2021-05-30
  • 2021-08-12
  • 2021-10-22
猜你喜欢
  • 2021-10-22
  • 2021-06-01
  • 2021-05-31
  • 2021-05-19
  • 2021-04-02
  • 2021-06-12
相关资源
相似解决方案