Ext.grid.ColumnModel renderer 参数介绍

Ext.grid.ColumnModel renderer 参数介绍 .

标签: headerfunctionbuttoninputcnull
  1126人阅读  评论(0)  收藏  举报
  分类:
 
 

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

 

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='查看详细信息' οnclick='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

 

}]);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值