zoukankan      html  css  js  c++  java
  • EasyUI使用技巧总结

    combobox组件

    一、禁用combobox里面的输入框

    $("选择器").combo('textbox').attr("readonly", "readonly");
    $('选择器').combobox({
    
      editable:false ,
        panelheight:300
    });

    二、禁用

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

    三、获取选项文本和值

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

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

    $("选择器").focus(function () {
        $(this).combo('showPanel');
        $(this).combo('textbox').focus();
        $($(this).combo('textbox')).unbind("keyup").bind("keyup", function (e) {
            if (e.keyCode == 13) {
    
                //do someting
            }
        });
    });

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

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

     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 });
    View Code

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

  • 相关阅读:
    Git 如何优雅地回退代码?
    如何让自己的技能变现?
    读了100本书,总结出读遍万卷书的 7 大方法
    08月10日总结
    08月09日总结
    08月08日总结
    08月06日总结
    08月04日总结
    08月03日总结
    剑指offer52 两个链表的第一个公共节点
  • 原文地址:https://www.cnblogs.com/lonny/p/easyui-use-skill.html
Copyright © 2011-2022 走看看