博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ext.Net 1.2.0_Ext.Net.RendererFormat 常用数据格式转换呈现格式
阅读量:4683 次
发布时间:2019-06-09

本文共 3945 字,大约阅读时间需要 13 分钟。

本文内容

  • 概述
  • Ext.Net.RendererFormat 枚举
  • 演示

 

概述

研究 Ext.Net Demo 时,经常能看到将 GridPanel 的某列添加 <Renderer Format="UsMoney" />",改变列的呈现。本文演示 Ext.Net 提供的常用数据格式函数。

 

Ext.Net.RendererFormat 枚举

Ext.Net 的 RendererFormat 枚举类型将一些常用的数据格式转换函数,也就是改变数据呈现的格式,变成枚举类型,以便重用。如下表所示:

函数枚举

说明

None

Capitalize

Converts the first character only of a string to upper case

Date

Parse a value into a formatted date using the specified format pattern

DateRenderer

Returns a date rendering function that can be reused to apply a date format multiple times efficiently

format : String

(optional) Any valid date format string (defaults to 'm/d/Y')

DefaultValue

Checks a reference and converts it to the default value if it's empty

Ellipsis

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length

defaultValue : String

The value to insert of it's undefined (defaults to "")

FileSize

Simple format for a file size (xxx bytes, xxx KB, xxx MB)

length : Number

The maximum length to allow before truncating

word : Boolean

True to try to find a common work break

HtmlDecode

Convert certain characters (&, &lt;, >, and ') from their HTML character equivalents

HtmlEncode

Convert certain characters (&, &lt;, >, and ') to their HTML character equivalents for literal display in web pages

Nl2br

Converts newline characters to the HTML tag &lt;br/>

Number

Formats the number according to the format string.

examples (123456.789):

0 - (123456) show only digits, no precision

0.00 - (123456.78) show only digits, 2 precision

0.0000 - (123456.7890) show only digits, 4 precision

0,000 - (123,456) show comma and digits, no precision

0,000.00 - (123,456.78) show comma and digits, 2 precision

0,0.00 - (123,456.78) shortcut method, show comma and digits, 2 precision

To reverse the grouping (,) and decimal (.) for international numbers, add /i to the end. For example: 0.000,00/i

NumberRenderer

Returns a number rendering function that can be reused to apply a number format multiple times efficiently

Lowercase

Converts a string to all lower case letters

Plural

Selectively do a plural form of a word based on a numeric value. For example, in a template, {commentCount:plural("Comment")} would result in "1 Comment" if commentCount was 1 or would be "x Comments" if the value is 0 or greater than 1

Round

Rounds the passed number to the required decimal precision.

singular : String

The singular form of the word

plural : String

(optional) The plural form of the word (defaults to the singular with an "s")

StripScripts

Strips all script tags

precision : Number

The number of decimal places to which to round the first parameter's value

StripTags

Strips all HTML tags

Substr

Returns a substring from within an original string

Trim

Trims any whitespace from either side of a string

start : Number

The start index of the substring

length : Number

The length of the substring

Undef

Checks a reference and converts it to empty string if it is undefined

Uppercase

Converts a string to all upper case letters

UsMoney

Format a number as US currency

EuroMoney

Format a number as Euro currency

 

演示

代码如下所示:

<%@ Page Language="C#" %>
 
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="System.Data" %>
 
 
 
 
1: 
2:         protected void Page_Load(object sender, EventArgs e)
3:         {
4:             if (!X.IsAjaxRequest)
5:             {
6:                 DataTable dt = ExtNetRendererFormatDemo.DataSource.CreateDataSource();
7:                 this.Store1.DataSource = dt;
8:                 this.Store1.DataBind();
9:             }
10:         }
11:
</
script
>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

运行界面:

说明:

1,两列“员工姓名”的区别,分别为全部大写和头字母大写;

2,两列“出生日期”的区别,日期格式不同;

3,两列“工作”的区别,分别为美元和欧元表示。

 

转载于:https://www.cnblogs.com/liuning8023/archive/2011/10/09/2204860.html

你可能感兴趣的文章
C中int8_t、int16_t、int32_t、int64_t、uint8_t、size_t、ssize_t区别
查看>>
python day2 模块初识、pyc定义
查看>>
一道算法作业题(续)
查看>>
Machine Learning From Scratch-从头开始机器学习
查看>>
基础数据结构
查看>>
018-伸展树
查看>>
FPM打包工具
查看>>
20145302张薇《Java程序设计》第八周学习总结
查看>>
WebApi2官网学习记录---单元测试
查看>>
Backbone.js源码分析(珍藏版)
查看>>
完全背包问题
查看>>
滴水穿石-09多线程
查看>>
[树形dp] Jzoj P1162 贪吃的九头龙
查看>>
Jquery 相关笔记
查看>>
利用表单发送邮件
查看>>
计算机一族必喝的四杯茶
查看>>
linux 下的ssh免密登陆设置
查看>>
【Hibernate 7】浅谈Hibernate的缓存机制
查看>>
润乾报表 动态控制文本的显示
查看>>
[oracle] 如何使用myBatis在数据库中插入数据并返回主键
查看>>