USEGEAR

导航

学习unigui【23】uniDBGrid的使用摘要

Unidbgrid自动调整列宽

UniDBGrid1 -> ClientEvents -> ExtEvents [Ext.data.Store[store] ] add store.load fn:

function store.load(sender, records, successful, eOpts)
{
  sender.grid.columnManager.columns.forEach(function(col){col.autoSize()})
}

UniDBGrid1.ForceFit:=True;//自适应宽度
在ServerModule模块中找到customcss进行编辑方式,将下面的代码加入到编辑框中去。自定义dbgrid格式

<style type="text/css"> /* unidbgrid */ /* ====================== */ /* 设置表头的样式 */ .x-column-header, .x-column-header-over { background-color:#F3E0C1 /* #e8eff4; 表头背景色 */ color: #333; /* 表头文字颜色 */ font-weight: bold; /* 字体加粗 */ text-align: center; /* 文字居中 */ /* border-bottom: 2px solid #d0d0d0; 表头底部边框线 */ font-size:11px !important } .x-grid-item { font-size:11px !important } /* 为表格行添加斑马条纹背景================================== */ .x-grid-item:nth-child(odd) .x-grid-cell { background-color: #F2F2F2; /* #F6F6F6;浅灰色背景 */ font-size:11px !important ; } .x-grid-item:nth-child(even) .x-grid-cell { background-color: #ffffff; /* 白色背景 */ font-size:11px !important ; } .x-grid-cell { padding: 0px; /* 内边距设置为0px */ white-space: normal; /* 允许自动换行 */ word-wrap: break-word; vertical-align: middle; } /* 长单词或URL可被拆分换行 height: 100%; align-items: center !important; */ .x-grid-cell-inner { padding: 0px; /* 内边距设置为8px */ line-height: 1.8; /* 行高设为1.5倍的字体大小 */ align-items: center !important; } /* 表格行选中样式 */ .x-grid-item-selected .x-grid-cell{ background-color:#FFDDDD !important;; vertical-align: middle; } /* 表格行选中样式 */ .x-grid-item-selected .x-grid-cell-inner { font-weight: bold !important; background-color:#FFDDDD !important;; } /* 鼠标悬停行样式 */ .x-grid-row:hover { background-color: #f1f1f1; } .x-grid-item-focused .x-grid-cell-inner:before { border: none !important; line-height: 1.8; /* 行高设为1.5倍的字体大小 */ } </style>

 

posted on 2024-03-09 11:36  USEGEAR  阅读(176)  评论(0编辑  收藏  举报