ABI选中表元样式

1641
0

xiaocesen 初学数据Lv2

发表于2021-11-19 19:54

楼主

      ABI选中表元的样式脚本,脚本写在客户端脚本中哦~
计算后默认选中第一个表元:

选中时的样式:



此脚本中效果钻取表元的字体也会生效,同时还更改了钻取表元字体的悬停颜色以及取消下划线样式~此处设定在脚本末尾。

下方附上脚本代码:
  1. /*
  2. 设置单元格的选中背景色和选中字体颜色
  3. */
  4. var grid1 = g_rptpage.getGridById("GRID1");
  5. var grid2 = grid1.getCellDom('A1') ;
  6. var bgiurl = "url(vfs/root/products/ebi/sys/picture/a.png)";//背景图片地址
  7. var fcolor = "#00F"
  8. var time=0;  
  9. grid1.selectedBgimage = bgiurl;
  10. grid1.selectedFontColor =fcolor;
  11. /*
  12. 设置选中表元的样式,cell为dom(td)
  13. */
  14. GridHtml.prototype.setCellStyle = function(cell){
  15.         grid2.style.backgroundImage =  "";//情况默认设置
  16.         var bc = this.selectedBgimage;
  17.         if (bc != cell.style.backgroundImage) {
  18.                 cell.style.backgroundImage = bc;
  19.                 cell.style.backgroundSize = "100% 100%";
  20.         }
  21.         grid2.childNodes[0].style.color =  "";
  22.         var selectedColor = this.selectedFontColor;
  23.         if (selectedColor != cell.style.color) {

  24.                 //cell.style.color = selectedColor;   
  25.                 cell.firstChild.style.color = selectedColor;//设置钻取表元字体颜色
  26.                
  27.         }
  28.     ++ time ;
  29. };

  30. if (time == 0){//设置默认选中
  31.         grid2.style.backgroundImage =  bgiurl;
  32.         grid2.firstChild.style.color = fcolor;
  33.         grid2.style.backgroundSize = "100% 100%";
  34. };

  35. /*
  36. 恢复一个表元的样式
  37. */
  38. GridHtml.prototype.gobackCellStyle = function(cell) {
  39.         var cellbgi= cell.style.backgroundImage;
  40.         if (cellbgi = bgiurl) {
  41.                 cell.style.backgroundImage = "";
  42.                                 cell.firstChild.style.color = "";
  43.         }
  44. };
  45. EUI.addStyleSheet("#GRID1 a:hover {color: #00F !important;}");
  46. EUI.addStyleSheet("#GRID1 a:hover {text-decoration: none !important;");
复制代码
                 随心所欲改变选中字体颜色和背景图片哦~赶紧用起来吧!!!

最近看过此主题的会员

wxw

hee

leiz

姜糖

1212111121

zhangfei_2

zhuhc

swx771067

前进者

hesj

liulei6511

CZHCZH

崔俊豪

陶雨萱

zhouwei

一一

0个回答

只看楼主

登录后可回答问题,请登录注册

快速回复 返回顶部 返回列表

小时

全天响应

分钟

快速处理问题

工程师强势助力

明星产品
解决方案
联系合作

400咨询:400-0011-866

技术支持QQ:400-0011-866(工作日9:00-18:00)

产品建议邮箱yixin@esensoft.com

关注我们

扫TA学习更多干货

一对一专家交流

版权所有© 2006-2024 北京亿信华辰软件有限责任公司 京ICP备07017321号 京公网安备11010802016281号