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

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲AV日韩精品久久久久久久| 久久福利资源网站免费看| 国产乱子影视频上线免费观看| 亚洲一级高清在线中文字幕| 精品无码免费专区毛片| 亚洲沟沟美女亚洲沟沟| 中文字幕乱码免费视频| 亚洲人成激情在线播放| 免费看香港一级毛片| 国产偷国产偷亚洲高清在线| 国产伦精品一区二区三区免费下载 | 亚洲AV无码精品无码麻豆| 中文字幕在线免费视频| 国产成人精品日本亚洲网站 | 亚洲黄色免费电影| 亚洲性无码av在线| 毛片a级毛片免费播放下载| 亚洲永久网址在线观看| 国产在线播放免费| 成全视成人免费观看在线看| 久热综合在线亚洲精品| h视频在线观看免费完整版| 亚洲永久网址在线观看| 亚洲色欲久久久久综合网| 国产免费伦精品一区二区三区 | 德国女人一级毛片免费| 黄色网址在线免费观看| 亚洲AV永久无码精品一百度影院 | 免费一区二区三区| 亚洲不卡视频在线观看| 国产一级做a爱免费视频| 中文字幕乱码免费看电影| 亚洲丝袜中文字幕| 亚洲精品无码av天堂| 日韩免费视频一区二区| 2020天堂在线亚洲精品专区| 亚洲人成国产精品无码| 亚洲免费在线视频播放| 菠萝菠萝蜜在线免费视频| 亚洲视频在线播放| 国产精品自在自线免费观看|