<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人片一区二区| 亚洲影视一区二区| 51视频精品全部免费最新| 亚洲高清中文字幕| 亚洲免费观看网站| 亚洲乱码一二三四区乱码| 青青久在线视频免费观看| 国产成人精品久久亚洲| 四虎影视久久久免费| 在线观看亚洲av每日更新| 国产精品成人亚洲| 亚洲国产成人a精品不卡在线| 亚洲国产精品一区| 中文字幕免费观看| 久久久久久亚洲精品影院| 大地影院MV在线观看视频免费| 国产日韩亚洲大尺度高清| 日韩精品极品视频在线观看免费 | 最近免费中文字幕大全高清大全1| 亚洲伦理一区二区| 免费精品国偷自产在线在线| 亚洲人成色777777精品| 免费a级毛片在线观看| 亚洲毛片免费视频| 妞干网免费视频在线观看| 免费无码国产V片在线观看| 一个人看www在线高清免费看| 亚洲成AV人片在线播放无码| 亚洲视频免费在线播放| 亚洲精品美女久久7777777| 四虎免费影院ww4164h| 涩涩色中文综合亚洲| 亚洲男人的天堂一区二区| 国产精品亚洲五月天高清| 久久影视国产亚洲| 日韩免费精品视频| 久久久久国色AV免费观看| 亚洲国产日韩在线成人蜜芽 | 亚洲国产精品福利片在线观看| h在线观看视频免费网站|