随笔 - 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 阅读(494) 评论(0)  编辑  收藏 所属分类: JavaScript学习

只有注册用户登录后才能发表评论。


网站导航: