定制Row的不同颜色

news/2024/7/4 0:53:59 标签: string, colors, parameters, class, include, output
class="baidu_pl">
class="article_content clearfix">
class="htmledit_views">

在系统的一览画面,我们有时候希望有的行的数据根据数据性质的不同而显示不同的颜色,

 Dinamica 默认只是处理的行的交叉色。

其他定制需要自己实现。

system win xp JP

Dinamica 2.1.4 with Ajax support.

正常的一览画面的显示部分,

调用的是默认的action  GenericOutput 。


配置文件部分如下:

class="xml" name="code"><output>   

<classname>dinamica.GenericOutput</classname> 

<template>template.htm</template>  

<set-http-headers>true</set-http-headers>  

<content-type>text/html</content-type>

现在我们进行定制,

 

从GenericOutput继承一个新的类MyGenericOutput 。

 基类GenericOutput的onNewRow 方法 如下所示:  

class="language-java">public String onNewRow(Recordset rs, String rowTemplate) throws Throwable

 {



  /*

   * This code is used to alternate row class="tags" href="/tags/COLORS.html" title=colors>colors,

   * the row template must include the special

   * field marker ${fld:_rowStyle} which will be replaced

   * by the style class="tags" href="/tags/PARAMETERS.html" title=parameters>parameters set in web.xml. 

   */

  

  String style1 = getContext().getInitParameter("def-color1");

  String style2 = getContext().getInitParameter("def-color2");

  String currentStyle="";

  

  if (rowColor==0)

  {

   rowColor=1;

   currentStyle = style1;

  }

  else

  {

   rowColor=0;

   currentStyle = style2;

  }

  

  rowTemplate = StringUtil.replace(rowTemplate, "${fld:_rowStyle}", currentStyle);

  

  return rowTemplate;



 }
class="language-java">我们需要对onNewRow方法进行重写
class="language-java">
class="java" name="code">class="language-java">public String onNewRow(Recordset rs, String rowTemplate) throws Throwable

	{

		String style1 = getContext().getInitParameter("def-color1");

		String style2 = getContext().getInitParameter("def-color2");

		String currentStyle="";

	

		if (EWWBDef.DATA_UPD_TYP_ADD.equals(rs.getValue("data_upd_typ")))

		{

			currentStyle = "class='specColor1'" ;

			rowTemplate = StringUtil.replace(rowTemplate, "${fld:_rowStyle}", currentStyle);

			

			return rowTemplate;

		}

		else if (EWWBDef.DATA_UPD_TYP_UPD.equals(rs.getValue("data_upd_typ")))

		{

			currentStyle = "class='specColor2'" ;

			rowTemplate = StringUtil.replace(rowTemplate, "${fld:_rowStyle}", currentStyle);

			

			return rowTemplate;

		}

		else if (EWWBDef.DATA_UPD_TYP_DEL.equals(rs.getValue("data_upd_typ")))

		{

			currentStyle = "class='specColor3" ;

			rowTemplate = StringUtil.replace(rowTemplate, "${fld:_rowStyle}", currentStyle);

			

			return rowTemplate;

		}

		else

		{

			return super.onNewRow(rs, rowTemplate) ;

			

		}

		

	}
class="language-java">上面的specColor1 ,specColor2,specColor3 需要在default.css中定制,
class="language-css">如下所示:
.grid tr.specColor1 td { background-color:#FFFFCC; } .grid tr.specColor2 td { background-color:#FAC5DA; } .grid tr.specColor3 td { background-color:#CC9900; }
class="language-java">
class="language-java">经过上面的修改就可以按照自己的要求定制行的颜色了。
class="language-java">最后不能忘了,在config.xml中配置调用新做成的class.不是默认的那个GenericOutput。

http://www.niftyadmin.cn/n/871977.html

相关文章

Dinamica使用 - 中文支持篇

现在Dinamica主要支持的是西班牙语的客户&#xff0c;英文的文档都很少更新了。 现在template,configue等的charset默认都是iso-8895-1 这样的话对中文的显示是无法支持的&#xff0c;为什么martin不设置成UTF8呢&#xff1f; 好歹有简便的方法来改变这种状态&#xff0c; 可…

idea创建父子工程module_SpringBoot第二十二篇:创建含有多module的springboot工程

这篇文章主要介绍如何在springboot中如何创建含有多个module的工程&#xff0c;栗子中含有两个 module&#xff0c;一个作为libarary. 工程&#xff0c;另外一个是主工程&#xff0c;调用libary .其中libary jar有一个服务&#xff0c;main工程调用这个服务。创建根工程创建一个…

hbuilder怎么使用自定义注释更新时间_织梦dedecms联动类别的图文使用方法

织梦dedecms联动类别的图文使用方法虽然我也不清楚联动类型这个专业术语应该怎么样解释&#xff0c;但我相信更多的人是不希望这篇教程是专门来解释这个术语的联动类别我们可以拆分为两个&#xff1a;联动和类别联动又可理解为联和动&#xff0c;联是关联的意思&#xff1b;动则…

jad links

http://www.varaneckas.com/jad

海湾gst5000主机消防广播_海湾:消防模块接线图(2020版)

1GST-LD-8300A输入模块GST-LD-8300A输入模块&#xff0c;用于接收消防联动设备输入的常开或常闭开关量信号&#xff0c;并将联动信息传回火灾报警控制器(联动型)。主要用于配接现场各种主动型设备如水流指示器、压力开关、位置开关、信号阀及能够送回开关信号的外部联动设备等。…

javascript中的readOnly

readO nly用来设置字段的只读属性&#xff0c; 但是如果写成reado nly就不起作用。区分大小写的。

uat环境是什么环境_山地环境在研究什么

作为一个环境专业的学生&#xff0c;如果提到山地环境就只能说“植被类型的垂直变化”&#xff0c;“每上升100米&#xff0c;温度下降0.4摄氏度”&#xff0c;“山体的阳面和阴面不同”然后就陷入尴尬的沉默。确实是挺尴尬的。关于山地研究&#xff0c;据我所知&#xff0c;有…

ORA-00907: missing right parenthesis

原文出处&#xff1a;[url]http://www.wangchao.net.cn/bbsdetail_71288.html[/url] 这一段时间&#xff0c;公司项目计划是旧数据的迁移&#xff0c;从MYSQL迁移至ORACLE&#xff0c;开了无数次会&#xff0c;讨论了若干次。 错误现象: 在从MYSQL导出sql脚本后&#xff0c;在…