zoukankan      html  css  js  c++  java
  • 解决jQuery的EasyUI的datagrid数据表格中行的垂直居中问题。

    默认jQuery EasyUI的datagrid的行的垂直方向上的对齐是text-top的。效果是这样:

    修改后效果是这样:

    解决办法:

    datagrid只有align属性,指的是水平方向的对齐方式,可以按照下面的方法设置css:

    在创建datagrid的时候设置column的styler:

    columns:[[
                            
                            {field:'监测网站',title:'监测网站',80,align:'center',
                                styler: function(value,row,index){
                                        return 'vertical-align:middle;';
                                }
                            }
          ]]

    官方对styler的解释:

    NameTypeDescriptionDefault
           
    styler function The cell styler function, return style string to custom the cell style such as 'background:red'. The function take three parameter:
    value: the field value.
    rowData: the row record data.
    rowIndex: the row index.

    Code example:

    $('#dg').datagrid({
    	columns:[[
    		{field:'listprice',title:'List Price', 80, align:'right',
    			styler: function(value,row,index){
    				if (value < 20){
    					return 'background-color:#ffee00;color:red;';
    				}
    			}
    		}
    	]]
    });
    
    undefined
           

    官方地址

  • 相关阅读:
    程序员掌握的单词汇总
    Django--基础补充
    C#入门概述
    python常用模块
    软件开发经验之谈
    p7.BTC-挖矿总结
    p6.BTC-挖矿难度
    p5.BTC-网络
    p4.BTC-实现
    p3.BTC-协议
  • 原文地址:https://www.cnblogs.com/sixiweb/p/2824784.html
Copyright © 2011-2022 走看看