隨筆 - 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學習

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


          網站導航:
           
          主站蜘蛛池模板: 苗栗县| 桦川县| 呼玛县| 宁夏| 梧州市| 云梦县| 棋牌| 迁安市| 望奎县| 五台县| 化德县| 和硕县| 曲周县| 望谟县| 怀集县| 嘉鱼县| 龙井市| 玉屏| 民权县| 南宫市| 水城县| 梁山县| 克拉玛依市| 句容市| 北京市| 信丰县| 永仁县| 蓬莱市| 威信县| 玉田县| 连云港市| 天全县| 昭通市| 平定县| 岢岚县| 科尔| 新河县| 拜城县| 从江县| 扶沟县| 绥芬河市|