<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    linugb118--java space

    Java

    easiUi--datagrid中兩項相加點擊第三項 自動獲取

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
    <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <title>jQuery EasyUI</title>
     <link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
     <link rel="stylesheet" type="text/css" href="../themes/icon.css">
     <script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
     <script type="text/javascript" src="../jquery.easyui.min.js"></script>
     <script>
      var products = [
          {productid:'FI-SW-01',name:'Koi'},
          {productid:'K9-DL-01',name:'Dalmation'},
          {productid:'RP-SN-01',name:'Rattlesnake'},
          {productid:'RP-LI-02',name:'Iguana'},
          {productid:'FL-DSH-01',name:'Manx'},
          {productid:'FL-DLH-02',name:'Persian'},
          {productid:'AV-CB-01',name:'Amazon Parrot'}
      ];
      function productFormatter(value){
       for(var i=0; i<products.length; i++){
        if (products[i].productid == value) return products[i].name;
       }
       return value;
      }

      function getSum()
      {
        alert(33);
      }  

      $(function () {
                var lastIndex;
                $('#tt').datagrid({
                    url: 'webjson.ashx',
                    title: 'Load Data ',
                    iconCls: 'icon-save',
                    singleSelect: true, 
                    loadMsg: '數據加載中請稍后……',
                    width: 600,
                    height: 300,               
                    columns: [[
                        { field: 'itemid', title: 'Item ID', width: 80 },
                        { field: 'productid', title: 'Product ID', width: 100 },
                        { field: 'listprice', title: 'List Price', width: 80, align: 'right', editor: "numberbox" }, //增加可編輯
                        { field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right', editor: "numberbox" },//增加可編輯
                        { field: 'attr1', title: 'Attribute', width: 150, editor: "numberbox" },//這里雖為編輯類型,但是已經修改源碼,成為不可以狀態
                        { field: 'status', title: 'Status', width: 60, align: 'center' }
                    ]],
                    pageSize: 5,
                    pageList:[5,10,20,30],
                     pagination: true,
                    rownumbers: true ,
    toolbar:[{
         text:'append',
         iconCls:'icon-add',
         handler:function(){
         $('#tt').datagrid('endEdit', lastIndex);
          $('#tt').datagrid('appendRow',{
           itemid:'',
           productid:'',
           listprice:'',
           unitprice:'',
           attr1:'',
           status:'P'
          });
          var lastIndex = $('#tt').datagrid('getRows').length-1;
          $('#tt').datagrid('beginEdit', lastIndex);
         }
        }],
                    onClickRow: function (rowIndex) {
                        if (lastIndex != rowIndex) {
                            $('#tt').datagrid('endEdit', lastIndex);
                            $('#tt').datagrid('beginEdit', rowIndex);
                            setEditing(rowIndex);
       //$('#tt').datagrid('refreshRow',rowIndex);

                        }
                        lastIndex = rowIndex;
                    }
                  
                });
            });
        
        
        
    //具體實現方法
            function setEditing(rowIndex) {
                var editors = $('#tt').datagrid('getEditors', rowIndex);
                var priceEditor = editors[0];
                var amountEditor = editors[1];
                var sumcount = editors[2];
                sumcount.target.bind('click', function () {
                   
                    var sum = priceEditor.target.val()+amountEditor.target.val();
                    alert(sum);
                    sumcount.target.val(sum);
     
                });
               
            }

     
     </script>
    </head>
    <body>
     <h1>Editable DataGrid</h1>
     
     <table id="tt" style="width:650px;height:auto"
       title="Editable DataGrid" iconCls="icon-edit" singleSelect="true">
     </table>
     
    </body>
    </html>

     

    posted on 2011-11-09 16:10 linugb118 閱讀(757) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    My Links

    Blog Stats

    常用鏈接

    留言簿(1)

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲日本一区二区一本一道 | 一本色道久久综合亚洲精品高清| 又黄又爽一线毛片免费观看 | 一个人在线观看视频免费 | 免费欧洲毛片A级视频无风险| 亚洲色成人网站WWW永久| 亚洲美女人黄网成人女| 亚洲AV无码成人精品区日韩| 一级中文字幕乱码免费| 日韩插啊免费视频在线观看 | 黄页网站在线看免费| 亚洲熟伦熟女新五十路熟妇| 四虎影视在线看免费观看| 亚洲一级毛片免费在线观看| 免费在线观看污网站| 亚洲第一视频在线观看免费 | 又黄又大又爽免费视频| 男女污污污超污视频免费在线看| 久99久精品免费视频热77| 国产一区二区三区免费视频| 女人裸身j部免费视频无遮挡| 亚洲日韩VA无码中文字幕| 永久在线观看免费视频| 日本高清免费不卡在线| 亚洲国产成人久久精品动漫| 杨幂最新免费特级毛片| 亚洲精品无码乱码成人| 美女隐私免费视频看| 九九精品免费视频| 国产成人亚洲午夜电影| 日本高清免费网站| 久久精品免费大片国产大片 | 日韩中文无码有码免费视频| 免费精品久久久久久中文字幕| 国产亚洲精品自在久久| 亚洲免费综合色在线视频| 一级做性色a爰片久久毛片免费| 亚洲国产香蕉碰碰人人| 国产伦精品一区二区三区免费下载 | 成人伊人亚洲人综合网站222| 亚洲免费人成视频观看|