easyui相关笔记

来源:互联网 发布:工程造价软件破解版 编辑:程序博客网 时间:2024/06/08 13:57
easyui datagrid表格点击不选中行不变色:

1.方法一
$('#dg').datagrid({
     onClickRow: function (rowIndex, rowData) {
                $(this).datagrid('unselectRow', rowIndex);
   }
})

2.方法二

$('#dg').datagrid({
    onBeforeSelect:function(){
        return false;
    },
})
3.更改选中状态的颜色或者鼠标滑过的颜色
<style type="text/css">
   .datagrid-row-selected {
   background: #fff;
   color: #000000;
}
.datagrid-row-over,.datagrid-header td.datagrid-header-over {
   background: #fff;
   color: #000000;
   cursor: default;
}
</style>

easyui datagrid单元格内容根据返回内容修改显示

  {field:'companyname',title:'订单公司',width:'14%',formatter:function(value,row,index){
    return ((row.companyname==null)?('<font color=\'red\'>未认证</font>'):(row.companyname));
    }},
  {field:'dctime',title:'下单时间',width:'6%',},
  {field:'type',title:'来源',width:'4%', formatter:function(value,row,index){
     if(row.type == '2'){
         return ('前台');
    }else if (row.type == '3'){
    return ('后台');
      };
}},

easyui datagrid表格 当后台没有数据返回 显示没有相关记录

     onLoadSuccess:function(data){
        if(parseInt(data.total)<=0){
                    $(this).datagrid('appendRow', { orderNum: '<div style="text-align:center;color:red">没有相关记录!</div>' }).datagrid('mergeCells', { index: 0, field: 'orderNum', colspan: 15 });
                $(this).closest('div.datagrid-wrap').find('a').removeAttr('href');
                $(this).closest('div.datagrid-wrap').find('div.datagrid-pager').hide();
                    }
                    else $(this).closest('div.datagrid-wrap').find('div.datagrid-pager').show();
              },
原创粉丝点击