<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)

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 最近的2019免费中文字幕| 亚洲人成欧美中文字幕| 亚洲精品黄色视频在线观看免费资源| 成人av免费电影| 国产精品高清视亚洲一区二区| 皇色在线视频免费网站| 亚洲人成日本在线观看| 一区二区无码免费视频网站| 亚洲乱码卡一卡二卡三| 国产福利在线免费| 亚洲伊人久久大香线蕉AV| 国产成人免费高清激情视频| 国产精品视频免费观看| 亚洲一区中文字幕在线电影网| 亚洲人成网站免费播放| 日韩亚洲人成在线| 青青青国产色视频在线观看国产亚洲欧洲国产综合 | 亚洲精品无码不卡在线播放HE| 两个人看的www免费高清| 国产AV无码专区亚洲AVJULIA | 免费h成人黄漫画嘿咻破解版| 无套内射无矿码免费看黄| 中文字幕亚洲乱码熟女一区二区 | 久久精品无码精品免费专区| 亚洲福利一区二区精品秒拍| 91在线视频免费91| 精品女同一区二区三区免费播放| 国产性爱在线观看亚洲黄色一级片 | 午夜亚洲av永久无码精品| 久久久久国色AV免费观看| 亚洲一区二区三区电影| 久久久久免费看黄A片APP| 美景之屋4在线未删减免费 | 在线观看人成视频免费| 2022国内精品免费福利视频| 亚洲AV美女一区二区三区| 成年大片免费视频| 182tv免费视频在线观看| 国产成人亚洲综合网站不卡| 亚洲综合区小说区激情区| 免费观看国产网址你懂的|