隨筆 - 100  文章 - 50  trackbacks - 0
          <2015年3月>
          22232425262728
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          我收藏的一些文章!

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <meta name="keywords" content="jquery,ui,easy,easyui,web">
          <meta name="description" content="easyui help you build your web page easily!">
          <title>jQuery EasyUI Demo</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="lib/jquery-1.7.2.js"></script>
          <script type="text/javascript" src="lib/jquery.easyui.min.js"></script>
          </head>
          <script type="text/javascript">
          function search(){ 
          var type = $("#type").val();
          if(type =='1'){
              $("#repayment_div").css('display','block');
          $("#Norepayment_div").css('display','none'); 
          //document.getElementById("repayment_div").style.display="block";
          //document.getElementById("Norepayment_div").style.display="none";
          $('#repayment').datagrid({ 
                url:'repayment.json',
                fitColumns:true,
                singleSelect:true,
           columns:[[
          {field:'code',title:'Code',width:100},
          {field:'name',title:'Name',width:100},
          {field:'price1',title:'Price1',width:100},
          {field:'price2',title:'Price2',width:100},
          {field:'price3',title:'Price3',width:100}
                ]]
                });
          }else if(type =='0'){
          $("#Norepayment_div").css('display','block');
          $("#repayment_div").css('display','none'); 
          //document.getElementById("repayment_div").style.display="none";
          //document.getElementById("Norepayment_div").style.display="block";
          $('#Norepayment').datagrid({ 
                url:'Norepayment.json',
           columns:[[
          {field:'code',title:'Code',width:100},
          {field:'name',title:'Name',width:100},
          {field:'price1',title:'Price1',width:100}
                 ]]
                });  
          }
          }
          </script>
          <body>
          <h1>DataGrid</h1>
          <div>
          記錄:
           <select id="type">
            <option value ="1">有記錄</option>
            <option value ="0">無記錄</option>
          </select>  
          <button onclick="search()">search</button>
          </div>
          <div id="repayment_div" style="display:none">
          <table id="repayment" ></table>
          </div>
           <div id="Norepayment_div"  style="display:none">
             <table id="Norepayment" ></table>
            </div>
           
          <!--
          <table id="repayment" style="display:none"></table>
             <table id="Norepayment" style="display:none" ></table>
          -->
          </body>
          </html>
          --json data
          -repayment.json

          {
          "total":28,"rows":
          [{
              "code": "0001",
              "name": "lin",
              "price1": "aaaa",
              "price2": "aaaa",
              "price3": "aaaa"
          },
          {
              "code": "0001",
              "name": "lin",
              "price1": "aaaa",
              "price2": "aaaa",
              "price3": "aaaa"
          }
          ]
          }
          --Norepayment.json
          {
          "total":28,"rows":
          [{
              "code": "0001",
              "name": "lin",
              "price1": "aaaa"
          },
          {
              "code": "0001",
              "name": "lin",
              "price1": "aaaa"
          }
          ]
          }
          posted on 2015-03-22 23:49 fly 閱讀(637) 評論(0)  編輯  收藏 所屬分類: JavaScript學習

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


          網站導航:
           
          主站蜘蛛池模板: 祁连县| 凉城县| 衡阳县| 浦县| 阿拉尔市| 嵩明县| 中宁县| 天柱县| 镇坪县| 洪湖市| 麻城市| 九江县| 杭州市| 馆陶县| 临沧市| 永城市| 通道| 罗定市| 翁牛特旗| 报价| 阳东县| 长治县| 固始县| 斗六市| 长丰县| 衡东县| 宣威市| 景洪市| 新源县| 泽普县| 巴马| 行唐县| 屏东市| 遵化市| 探索| 伊宁县| 东安县| 五河县| 襄汾县| 伊吾县| 稻城县|