extjs hb

<link rel="stylesheet" type="text/css" href="<%=rootPath%>/scripts/extjs/lib/resources/css/ext-all.css" />
  <script type="text/javascript" src="<%=rootPath%>/scripts/extjs/lib/adapter/ext/ext-base.js"></script>
  <script type="text/javascript" src="<%=rootPath%>/scripts/extjs/lib/ext-all-debug.js"></script>
  <script type="text/javascript" src="<%=rootPath%>/scripts/extjs/lib/locale/ext-lang-zh_CN.js"></script>

<html>
 <head>
  <title></title> 

<style type="text/css">
       .x-grid-cell-line-back{
           background-color:#FFFFFF;
           border-top-width: 0px;
           border-bottom-width: 0px;
       }
       .x-grid-cell-row-line{
           border-bottom: 1px dotted #999999;
                 border-top-color: #FFFFFF;
                 cursor: pointer;
       }
       .x-grid-cell-row-line2{
           border-bottom: 1px dotted #999999;
                 border-top-color: #FFFFFF;
                 cursor: default;
       }
       .x-grid3-row {
           border-top-width: 0px;
           border-bottom-width: 0px;
       }
  </style>
  <script type="text/javascript">
  
    Ext.onReady(function(){ 
       Ext.QuickTips.init();
       Ext.form.Field.prototype.msgTarget = 'side';
 
    var dataGr = [
             ['','北京','13434','34545','645345'],
             ['中国','上海','2343','64345','44545'],
             ['','广州','4343','75656','53454'],
             ['','深圳','33434','7535','4545']
         ];
 var consolidateStore =  new Ext.data.SimpleStore({
  fields:['calculationIndex', 'indexName', 'firstValue', 'secondValue','thirdValue'],
  data : dataGr
 });
 var cm = new Ext.grid.ColumnModel([{
        header: '国际',
        dataIndex: 'calculationIndex',
        align: 'center',
        renderer:function(value, cellmeta, record,rowIndex,columnIndex ) {
              cellmeta.css='x-grid-cell-line-back'; 
              return value;
        }         
    }, {
        header: '城市',
        dataIndex: 'indexName',
        align: 'left',
        renderer:function(value, cellmeta, record,rowIndex,columnIndex ) {
              cellmeta.css='x-grid-cell-row-line2'; 
              return value;
        }
    }, {
        header: '2009',
        dataIndex: 'firstValue',
        align: 'right',
        editor: new Ext.form.NumberField({
   decimalPrecision:2,
   maxLength:20,
   maxLengthText:'输入字数不能超过20位'
  }),
        renderer:function(value, cellmeta, record,rowIndex,columnIndex ) {
              cellmeta.css='x-grid-cell-row-line'; 
              return value;
        }
    }, {
        header: '2010',
        dataIndex: 'secondValue',
        align: 'right',
        editor: new Ext.form.NumberField({
   decimalPrecision:2,
   maxLength:20,
   maxLengthText:'输入字数不能超过20位'
  }),
        renderer:function(value, cellmeta, record,rowIndex,columnIndex ) {
              cellmeta.css='x-grid-cell-row-line'; 
              return value;
        }
    }, {
        header: '2011',
        dataIndex: 'thirdValue',
        align: 'right',
        editor: new Ext.form.NumberField({
   decimalPrecision:2,
   maxLength:20,
   maxLengthText:'输入字数不能超过20位'
  }),
        renderer:function(value, cellmeta, record,rowIndex,columnIndex ) {
              cellmeta.css='x-grid-cell-row-line'; 
              return value;
        }
    }]);
    var grid = new Ext.grid.EditorGridPanel({
        store:consolidateStore,
     mode:'local',
        //columnLines: true,
        clicksToEdit:1,
        stripeRows: true,
     cm: cm,
     //autoWidth:true,
     autoHeight:true,
        //height:200,
        width:550,
        title: 'ExtJS4 EditGrid(可编辑的Grid)',
        frame: true,
        loadMask: true
      });
     grid.on({
        cellclick:function(g,rowIndex,columnIndex,e){
                var gridRecord = g.getStore().getAt(rowIndex);
                var fieldName = g.getColumnModel().getDataIndex(columnIndex);
                if('author'==fieldName){
                }
            }   
      }); 
     grid.render(Ext.getBody());
 });  
  
</script>
 </head>
 <body>
           
 </body>
</html>

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值