jqwidgets: Grid Cells Formatting

http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cellsformatting.htm

$("#jqxgrid").jqxGrid(
{
    width: 670,
    height: 450,
    source: source,
    theme: theme,
    sortable: true,
    columns: [
        { text: 'Ship Name', datafield: 'ShipName', width: 250 },
        { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' },
        { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' },
        { text: 'Ship Address', datafield: 'ShipAddress', width: 350 },
        { text: 'Ship City', datafield: 'ShipCity', width: 100 },
        { text: 'Ship Country', datafield: 'ShipCountry', width: 100 }
    ]
});

Number format strings:

"d" - decimal numbers.

"f" - floating-point numbers.

"n" - integer numbers.

"c" - currency numbers.

"p" - percentage numbers.

For adding decimal places to the numbers, add a number after the formatting string.

For example: "c3" displays a number in this format $25.256

Built-in Date formats:

// short date pattern

"d" - "M/d/yyyy",

// long date pattern

"D" - "dddd, MMMM dd, yyyy",

// short time pattern

"t" - "h:mm tt",

// long time pattern

"T" - "h:mm:ss tt",

// long date, short time pattern

"f" - "dddd, MMMM dd, yyyy h:mm tt",

// long date, long time pattern

"F" - "dddd, MMMM dd, yyyy h:mm:ss tt",

// month/day pattern

"M" - "MMMM dd",

// month/year pattern

"Y" - "yyyy MMMM",

// S is a sortable format that does not vary by culture

"S" - "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss"

Date format strings:

"d"-the day of the month;

"dd"-the day of the month;

"ddd"-the abbreviated name of the day of the week;

"dddd"- the full name of the day of the week;

"h"-the hour, using a 12-hour clock from 1 to 12;

"hh"-the hour, using a 12-hour clock from 01 to 12;

"H"-the hour, using a 24-hour clock from 0 to 23;

"HH"- the hour, using a 24-hour clock from 00 to 23;

"m"-the minute, from 0 through 59;

"mm"-the minutes,from 00 though59;

"M"- the month, from 1 through 12;

"MM"- the month, from 01 through 12;

"MMM"-the abbreviated name of the month;

"MMMM"-the full name of the month;

"s"-the second, from 0 through 59;

"ss"-the second, from 00 through 59;

"t"- the first character of the AM/PM designator;

"tt"-the AM/PM designator;

"y"- the year, from 0 to 99;

"yy"- the year, from 00 to 99;

"yyy"-the year, with a minimum of three digits;

"yyyy"-the year as a four-digit number;

"yyyyy"-the year as a four-digit number.

Grid Cells Formatting Sample

$("#jqxgrid").jqxGrid(
{
    width: 670,
    height: 450,
    source: source,
    theme: theme,
    sortable: true,
    columns: [
        { text: 'Ship Name', datafield: 'ShipName', width: 250, sortable: false },
        { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' },
        { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' },
        { text: 'Ship Address', datafield: 'ShipAddress', width: 350 },
        { text: 'Ship City', datafield: 'ShipCity', width: 100 },
        { text: 'Ship Country', datafield: 'ShipCountry', width: 100 }
    ]
});
时间: 2024-10-07 07:22:31

jqwidgets: Grid Cells Formatting的相关文章

How to determine which grid cells a line segment passes through?

https://cn.mathworks.com/matlabcentral/answers/230155-how-to-determine-which-grid-cells-a-line-segment-passes-through How to determine which grid cells a line segment passes through? Hi, I apologize if this question has been asked before but I have l

dojo grid 分页

dojo很强大,也很方便,但是缺少文档,只能看源代码,也挺好的,就是费时间... 网上找了一段代码(找不到原出处了,不好意思),也看了dojo自带的demo,放一段可以执行的页面代码这里.把ip换成自己架设的js服务器(esi的CDN貌似有点问题)即可 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; ch

【jQWidgets】导出数据

//导出 $("#excelExport").click(function () { $("#jqxgrid").jqxGrid('exportdata', 'xls', 'jqxGrid'); }); $("#xmlExport").click(function () { $("#jqxgrid").jqxGrid('exportdata', 'xml', 'jqxGrid'); }); $("#csvExport

jQWidgets笔记

http://www.jqwidgets.com/jquery-widgets-demo/ 常用: //设置列间距可调 $('#jqxGrid').jqxGrid({ columnsresize: false}); //获取是否可调值 var columnsresize = $('#jqxGrid').jqxGrid('columnsresize'); //数据绑定完成后事件 $("#jqxGrid").on("bindingcomplete", function

MFC Grid control 2.27

MFC Grid control author:songyanwu MFC Grid control属性介绍: The control features: Cell selection using the mouse, with optional Control and Shift key combinations. Selection can be disabled. Row and Column resizing. Sizing can be disabled for row, column

Codeforces Round #589 (Div. 2) B——B. Filling the Grid

Suppose there is a h×wh×w grid consisting of empty or full cells. Let's make some definitions: riri is the number of consecutive full cells connected to the left side in the ii-th row (1≤i≤h1≤i≤h). In particular, ri=0ri=0 if the leftmost cell of the 

YOLO v2 损失函数源码分析

损失函数的定义是在region_layer.c文件中,关于region层使用的参数在cfg文件的最后一个section中定义. 首先来看一看region_layer 都定义了那些属性值: layer make_region_layer(int batch, int w, int h, int n, int classes, int coords) { layer l = {0}; l.type = REGION; l.n = n; // anchors 的个数, 文章中选择为5 l.batch

463 Island Perimeter

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one isla

响应式Web设计 - 布局

可扩展的布局 有一种流体布局的概念在早起web兴起的时,就开始盛行了.它的概念是说页面会根据浏览器窗口的变化进行更改,网站可以通过维护一套代码,保质一致性的设计.我这里强调的可扩展的布局也是基于这个概念,只是现在的方法多种多样,因此要强调页面布局的可扩展性. 可扩展的布局途径有很多,比如常见的百分比布局,以及一直未成为标准的栅格布局等等. 框架 就从这框架来说,以一个常见的可扩展的三栏布局为例,就有数十种方法,这里抛砖引玉举几个例子. 方法1: Demo1 方法2: Demo2 方法3: Dem