`
韩悠悠
  • 浏览: 829390 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Ext.grid.ColumnModel renderer 参数介绍

阅读更多

使用时注意参数顺序位置:

1. renderer:function (value, cellmeta, record, rowIndex, columnIndex, store) { 

 value :这个单元格的值;

cellmeta.cellId: 这个单元格的配置

cellmeta.id:  id

record :这个单元格对应的record

rowIndex 这是第几行

store 这个表格对应的Ext.data.Store

}

 2.  function renderDescn(value, cellmeta, record, rowIndex, columnIndex, store) {       
        var str = "<input type='button' value='查看详细信息' onclick='alert(\"" +
            "这个单元格的值是:" + value + "\\n" +
            "这个单元格的配置是:{cellId:" + cellmeta.cellId + ",id:" + cellmeta.id + ",css:" + cellmeta.css + "}\\n" +
            "这个单元格对应行的record是:" + record + ",一行的数据都在里边\\n" +
            "这是第" + rowIndex + "行\\n" +
            "这是第" + columnIndex + "列\\n" +
            "这个表格对应的Ext.data.Store在这里:" + store + ",随便用吧。" +
            "\")'>";
        return str;
    }

使用实例:

    //--------------------------------------------------列选择模式

    var sm = new Ext.grid.CheckboxSelectionModel({

        dataIndex: "openroomid"

    });

    //--------------------------------------------------列头

    var cm = new Ext.grid.ColumnModel([

sm, {

   header: "开房ID",

   dataIndex: "openroomid",

   tooltip: "开房唯一标识ID",

   //列不可操作

   //menuDisabled:true,

   //可以进行排序

   sortable: true

}, {

   header: "房间号",

   tooltip: "客人所住房间编号",

   dataIndex: "roomid",

   sortable: true,

   renderer: function(value) {

       return "<a herf='Default.aspx' target='_blank'>" + value + "</a>"

   }

}, {

   header: "所付定金",

   tooltip: "客人所付定金",

   dataIndex: "guestmoney",

   sortable: true,

   renderer: function(value) {   //将数字转换为整数

       if (value != null && value != "") {

           var a, b, c, i

           a = value.toString();

           b = a.indexOf('.');

           c = a.length;

           if (b != -1)

               a = a.substring(0, b);

       }

       if (b == -1) {

           a = a + ".";

           for (i = 1; i <= c; i++)

               a = a - "0";

       }

       else {

           a = a.substring(0, b + c + 1);

           for (i = c; i <= b + c; i++) {

               a = a - "0";

           }

       }

       return '<span style="color:red;"><b>' + String.format("<font color=red>¥{0}</font>", a) + '</b>&nbsp;元</span>';

   }

}, {

   header: "开房日期",

   tooltip: "开房具体日期",

   dataIndex: "OpenTodayTime",

   sortable: true

}]);

 

 

 

分享到:
评论

相关推荐

    Ext.grid.ColumnModel显示不正常

    Ext.grid.ColumnModel显示不正常

    EXT grid中根据每一行的状态列内容来让当前行显示不同的背景颜色

    EXT中根据返回的grid中的状态列的内容来改变这一行显示的背景颜色

    EXT核心API详解

    69、Ext.grid.ColumnModel类 ……… 58 70、Ext.grid.PropertyColumnModel类 … 59 71、Ext.grid.GridView类 …………… 59 72、Ext.grid.GroupingView类 ………… 60 73、Ext.grid.EditorGridPanel类 ……… 62 74...

    ext可编辑表格

    var cm = new Ext.grid.ColumnModel({ columns: [{ id: 'common', header: 'Common Name', dataIndex: 'common', width: 220, // 使用上边定义好的别名 editor: new fm.TextField({ allowBlank: false }) ...

    ExtJS入门教程(超级详细)

    69、Ext.grid.ColumnModel类 ……… 58 70、Ext.grid.PropertyColumnModel类 … 59 71、Ext.grid.GridView类 …………… 59 72、Ext.grid.GroupingView类 ………… 60 73、Ext.grid.EditorGridPanel类 ……… 62 74...

    JavaScript的ExtJS框架中表格的编写教程

    表格的列信息由Ext.grid.ColumnModel定义 表格的数据存储器由Ext.data.Store定义,根据解析数据的不同,数据存储器可具体分为如下几种: JsonStore,SimpleStore,GroupingStore… 一个表格的基本编写过程: 1、创建...

    JSP+EXt2.0实现分页的方法

    本文实例讲述了JSP+EXt2.0实现分页的...var cm = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), sm, {header:'编号',dataIndex:'id',sortable:true}, {header:'名称',dataIndex:'name',sortable:true},

    ext简单例子

    Ext.onReady(function(){ var cm = new Ext.grid.ColumnModel([ {header:'Id',dataIndex:'id'}, {header:'Name',dataIndex:'name'},

    JavaScript中使用sencha gridpanel 编辑单元格、改变单元格颜色

    表格的列信息由类Ext.grid.Column(以前是由Ext.grid.ColumnModel定义)、而表格的数据存储器由Ext.data.Store定义,数据存储器根据解析的数据不同分为JsonStore、SimpleStroe、GroupingStore等。 下面

    Ext 开发指南 学习资料

    修改一个grid的ColumnModel和Store A.9.3. 动态为ds添加参数baseParams A.10. 有关tree的一些小问题 A.10.1. 如何选中树中的某个节点 A.10.2. 刷新树的所有节点 A.10.3. 如果取得json中自定义的属性 A.11. 如何使用...

    ExtJS 2.0 GridPanel基本表格简明教程

    表格的列信息由类Ext.grid.ColumnModel定义、而表格的数据存储器由Ext.data.Store定义,数据存储器根据解析的数据不同分为JsonStore、SimpleStroe、GroupingStore等。 我们首先来看最简单的使用表格的代码: 代码...

    Ext2.2动态生成ColumnModel

    NULL 博文链接:https://mogen9999.iteye.com/blog/262819

    Extjs4 GridPanel的主要配置参数详细介绍

    1、Ext.grid.GridPanel 主要配置项: store:表格的数据集 columns:表格列模式的配置数组,可自动创建ColumnModel列模式 autoExpandColumn:自动充满表格未用空间的列,参数为列id,该id不能为0 stripeRows:表格...

    ExtJS获取字段宽度顺序调整后的状态

    ExtJS记录字段宽度顺序状态,当用户拖动字段,修改宽度、调整顺序时可以获取调整后的顺序、宽度,

    extjs 学习笔记(三) 最基本的grid

    jquery在这方面则正好相反,它的UI都以插件形式提供,可以需要什么就引用什么,... 一个grid包括一些行和列,在extjs里边,列由Ext.grid.ColumnModel来管理,我们来看看如何创建一个ColumnModel对象: 代码如下: var cm

    extjs render 用法介绍

    代码如下: var cm = new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer({ header: “”, width: 20, align: ‘center’ }), { header: ”, align: ‘center’, dataIndex: ‘AccountAndRoseID’, width: 50, ...

    EXTGrid属性方法

    extjs 4.0 Grid属性方法以及常用操作,板面属性和对象

    Extjs EditorGridPanel中ComboBox列的显示问题

    为了解决这个问题需要在EditorGridPanel的ColumnModel中显示ComboBox的地方使用renderer属性,重新渲染,方法如下: 代码如下: //部门列表 var comboxDepartmentStore = new Ext.data.Store({ proxy: new Ext.data....

    xpTable,c# xptable NET中最强,最全功能的表格控件 ,可以定制一个ListView,能够在列中插入图像、下拉框、可上下调整的数字、进度条

    可以定制一个ListView,能够在列中插入图像、下拉框、可...然后,拖动Table, ColumnModel 和 TableModel到Form上,设置Table的ColumnModel 和 TableModel属性,添加Column到ColumnModel,添加Row 和 Cell到TableModel.

Global site tag (gtag.js) - Google Analytics