1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
31
编码32
34
名称35
36
38
名称51
63
价格64
65
66
67
68
69
70
71
72
编号:73
74
75
76
77
78
79
用户名:80
81
82
83
84
85
年龄:86
87
88
89
90
91
性别:92
93
94
95
96
97
98
99
100
101
102
103 //↓取到数据表格,添加属性↓
104 $('#dg').datagrid({105 //↓url:一个URL从远程站点请求数据。↓
106 url:'dodatagrade.php',
107 //↓fitColumns:true,真正的自动展开/收缩列的大小,以适应网格的宽度,防止水平滚动。↓
108 fitColumns:true,
109 //↓pagination:boolean 如果为true,则在DataGrid控件底部显示分页工具栏。 ↓
110 pagination:true,
111 //↓定义分页工具栏的位置。可用的值有:'top','bottom','both'。112 //↑pagePosition:"top",113
114 //↓rownumbers:boolean 如果为true,则显示一个行号列。
115 rownumbers:true,
116 //↓singleSelect:boolean 如果为true,则只允许选择一行。
117 ctrlSelect:true,
118
119 //↓pageSize:number 在设置分页属性的时候初始化页面大小。
120 pageSize:5,
121 //↓pageList array 在设置分页属性的时候 初始化页面大小选择列表。
122 pageList:[5,10,15,20],
123
124 //↓如果为true,当用户点击行的时候该复选框就会被选中或取消选中。125 //checkOnSelect:true,
126
127
128 /*
129 rowStyler function :130 返回样式如'background:red'。带2个参数的函数:131 index:该行索引从0开始132 row:与此相对应的记录行。*/
133 rowStyler:function(index,row){134 if(index%2 !=0){135 return "background:skyblue";136 }else{137 return "background:#693";138 }139 },//↑单行背景色为skyblue,双数行背景颜色为#693
140
141
142 /*↓ onDblClickRow:function143 在用户双击一行的时候触发,参数包括:144 index:点击的行的索引值,该索引值从0开始。145 row:对应于点击行的记录。*/
146 onDblClickRow:function(index,row){147 //↓ 取到dialog(对话框)中的各个input的id,通过texbox的setvalue给赋值点击行的内容
148 $("#id").textbox("setValue",row.id);149 $("#username").textbox("setValue",row.username);150 $("#age").textbox("setValue",row.age);151 $("#sex").textbox("setValue",row.sex);152 //↓ 取到dialog(对话框)整体的框架id,一开始是隐藏,加入closed:false,则消息框重新弹出。
153 $('#dd').dialog({ //属于点击之后弹出对话框
154 closed:false
155 });156 }157
158 });159 //↓ 对话框的属性设置:
160 $('#dd').dialog({161 width: 400,
162 height: 200,
163 //↓ 对话框设置隐藏
164 closed: true,
165 //↓cache:boolean 如果为true,在超链接载入时缓存面板内容。
166 cache: false, //我也不知道具体是什么意思,copy有,没敢乱删167 // modal:boolean 定义是否将窗体显示为模式化窗口。
168 modal: true
169 });170
171