JQuery easyui
- <body>
- <form id="form1" runat="server">
- <table id="tt">
- </table>
- </form>
- </body>
引用的JS:
- <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/script/themes/default/easyui.css" />
- <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/script/themes/icon.css" />
- <script type="text/javascript" src="http://www.cnblogs.com/script/jquery-1.4.2.min.js" </script>
- <script type="text/javascript" src="http://www.cnblogs.com/script/jquery.easyui.min.js" </script>
- <script type="text/javascript" src="http://www.cnblogs.com/script/locale/easyui-lang-zh_CN.js" mce></script>
JS:
- <script type="text/javascript"><!--
- $(function(){
- $('#tt').datagrid({
- width:810,
- height:400,
- idField:'xsbh',
- url:'studentHandler.ashx',
- singleSelect:true,
- columns:[[
- {field:'xsbh',title:'编号',width:80},
- {field:'UserName',title:'姓名',width:100},
- {field:'Sex',title:'性别',width:30},
- {field:'SchoolYear',title:'年份',width:50},
- {field:'opt',title:'操作',width:100,align:'center',
- formatter:function(value,rec,index){
- var s = '<a href="#" mce_href="#" onclick="view(\''+ rec.xsbh + '\')">查看</a> ';
- var e = '<a href="#" mce_href="#" onclick="edit(\''+ rec.xsbh + '\')">编辑</a> ';
- var d = '<a href="#" mce_href="#" onclick="del(\''+ index +'\')">删除</a> ';
- return s+e+d;
- }
- }
- ]],
- toolbar:[{
- text:'增加',iconCls:'icon-add',handler:function(){
- window.location.href='StuAdd.aspx';
- }
- },
- {text:'导入',iconCls:'icon-add',handler:function(){
- window.location.href='StuImport.aspx'
- }
- },
- {text:'查找',iconCls:'icon-search'}
- ],
- pagination:true
- });
- })
- function view(bh) //转到查看页面
- {
- window.location.href='StuView.aspx?id='+bh+'&page=stu';
- // var row = $('#tt').datagrid('getSelected');
- // if(row)
- // {
- // alert(row.xsbh);
- // }
- }
- function edit(bh) //转到编辑页面
- {
- window.location.href='StuEdit.aspx?id='+bh;
- }
- function del(index){ //删除操作
- $.messager.confirm('确认','确认删除?',function(row){
- if(row){
- var selectedRow = $('#tt').datagrid('getSelected'); //获取选中行
- $.ajax({
- url:'delHandler.ashx?id='+selectedRow.xsbh+'&type=stu',
- //加了个type,作用是以后不管什么删除,都可以转到这个ashx中处理
- success:function(){alert('删除成功');}
- });
- $('#tt').datagrid('deleteRow',index);
- }
- })
相关推荐
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
SoShellon 2013-06-01
羽化大刀Chrome 2013-05-31
LutosX 2013-07-29
淡风wisdon大大 2020-06-06
chenshuixian 2013-06-01
ligaoyuan00 2013-03-31
swift 2013-03-26
quanhaoH 2013-06-17
myloveqiqi 2020-08-09
猫沙盆 2020-07-08
猫沙盆 2020-07-07
云端漂移 2020-07-06
xiaohuli 2020-06-11
葉無聞 2020-06-09
福叔 2020-06-02
CaiKanXP 2020-06-02