easyui阶段小结

  1. 添加鼠标悬停事件:

    $('.datagrid-body .datagrid-cell').each(function () {
         $(this).attr('title',$(this).text());
     });
    

    或者:

    $('.datagrid-body .datagrid-cell').mouseover(function () {
         $(this).attr('title',$(this).text());
      });
    

    或者:

    $('body').on('mousemove',function (e) {         
           var $target = $(e.target);
           if($target.hasClass('datagrid-cell') && $target.closest('.datagrid-body').length !== 0)
           {
               $target.attr('title',$target.text());
           } });
    
  2. 添加combobox模糊查询,在初始化的方法里添加:
    filter: function(q, row){
    var opts = $(this).combobox(‘options’);
    return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
    }
  3. 获取combobox所有的值:
    var data =$(“#id”).combobox(“getData”);
    删除List accessList中的某个值(accounts):
    delete accessList.accounts;

  4. 链接按钮(linkbutton)用于创建一个超链接按钮。
    它是一个正常的a标签表示。它可显示图标和文本,或者仅仅显示图标
    和文本中的一个.需要在自己定义的class后面添加easyui-linkbutton
    class=”easyui-linkbutton”;

  5. 获取当前页面高度:
    var mainH = document.documentElement.clientHeight-70;
    或者
    $(window).height();

    动态赋高度值:
    $(“#id”).css(“height”,mainH);

  6. 默认选中datagrid第n行:
    $(‘#tableId’).datagrid(‘selectRow’,n);

  7. 获取datagrid数据:
    //获取所有行
    var rows = $(“#tableId”).datagrid(“getRows”);

    //返回第一个被选中的行或如果没有选中的行这返回null。
    var selectRow = $(“#tableId”).datagrid(“getSelected”);

    //返回所有被选中的行,当没有记录被选中的时候将返回一个空数组。
    var selectRows = $(“#tableId”).datagrid(“getSelections”);

    //在复选框被选中的时候返回所有行。
    var selectRows = $(“#tableId”).datagrid(“getChecked”);

  8. 循环遍历,获取所选内容中某一列(BATCH_NO)的所有值:
    var selectRows = $(“#bankDataGrid”).datagrid(‘getSelected’);

    var batchIDArr =new Array();
    //v为selectRows的每一个对象
    $.each(selectRows,function(i,v){
    if(!contains(batchIDArr, v[‘BATCH_NO’])){
    batchIDArr.push(v[‘BATCH_NO’]);
    }
    });

  9. 为table中的某个单元格xx添加超链接单击事件:
    formatter:function(value,row,index){
    return
    ‘< a href=”#” style=”color:blue” οnclick=doOpenItemChoseDig(“row”);>’+row.INS_TYPE_CODE+’’;
    }

  10. 在row中添加字段BIUD:
    if (row.BIUD == false || !row.BIUD){
    row.BIUD = true;
    }

  11. 修改datagrid 某一列字体颜色:
    {field:’balance’,title:’余额’,width:200,align:’right’,halign:’center’,
    styler: function(value,row,index){
    return ‘color:#ffc900;’;
    },formatter:formatMoney}

  12. 刷新某一行:
    $(‘#tableId’).datagrid(‘refreshRow’, i);

  13. 动态选中页签
    $(‘#dialogTypeTab’).tabs(‘select’,title);

  14. 进度条:
    $(‘#id’).progressbar(‘setValue’,proValueOld);

    $(‘#id’).progressbar(‘getValue’);

  15. 绑定combobox失去焦点:blur
    当焦点离开金额AMOUNT编辑框时,计算合计值

    var AMOUNTed = $(‘#billDetailList’).datagrid(‘getEditor’,
    {index:index,field:’AMOUNT’});

    $(AMOUNTed.target).bind(“blur”,function(){

    row.AMOUNT = $(AMOUNTed.target).val();
    });

  16. 绑定combobox的焦点事件

    $(“#bkBank”).combobox(‘textbox’).bind(‘focus’,function(){

    if($(“#bkBank”).combobox(“getText”)==”–全部–”){

    $(‘#bkBank’).combobox(‘clear’);
    }
    });

  17. 去除前后空格:
    function dropTrim(str){
    str = $.trim(str);
    return str;
    }

  18. dialog动态添加css:
    这里写图片描述

    $(“.dialog-button .l-btn”).attr(“onclick”,”return
    false”).addClass(“disabled”);

  19. 判断class是否存在:
    (“#test”).hasClass(“test”);

  20. 移除easyui树选中的节点
    $(‘#ioItemTree’).find(‘.tree-node-selected’).removeClass(‘tree-node-selected’);

  21. 单选框去掉前面小圆点(css):
    inputRadio{
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
    margin: 4px 0 0;
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值