1.0的验收老师提到最多的是:无处不按钮,无处不入口。在后面的开发中牢记了这个思想,行动下移。比如对表格的操作,不能只限于工具栏上的按钮,选中一条数据后需得选按钮,索性不给它设计工具栏,点击哪里都是按钮。
1.html
这是一个编辑试卷的功能,页面中首先显示试卷的题型,然后点击题型可以进入到题目列表页。
<table id="dg" class="easyui-datagrid" title="编辑试题-显示试卷题型" style="height:65%;width:100%"
data-options="rownumbers:true,pagination:true,pageSize:5,pageList:[5,10,15,20],method:'get',toolbar:'#tb',
onClickRow:onClickRow">
<thead>
<tr>
<th field="map.paperID" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['paperID'];}">paperID</th>
<th field="map.questionTypeId" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['questionTypeId'];}">题型id</th>
<th field="map.tableName" width="70%" align="center" data-options="formatter:function(value, rec){return rec.map['tableName'];}">表名</th>
<th field="map.name" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['name'];}">题型</th>
</tr>
</thead>
</table>
<div id="tb" style="padding: 2px 5px;">
<a href="#" class="easyui-linkbutton" iconCls="icon-search" οnclick="view()">预览</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-undo" οnclick="back()">返回</a>
</div>
2.js
function onClickRow(rowNum,record){
$.messager.confirm('提示','是否要查看题目?', function (r) {
if(r){
var paperID = record.map.paperID;//试卷id
var questionTypeId = record.map.questionTypeId;//题型id
var tableName = record.map.tableName;//标明
//跳转到下一页QuestionList
window.location.href ="${pageContext.request.contextPath}/QuestionList?paperID=" + paperID
+ '&questionTypeId=' + questionTypeId + '&tableName=' + tableName;
}
});
}
点击行的哪里都能触发该事件
3.controller
@RequestMapping("/QuestionList")
/**
* 编辑试题,点击一种题型后,显示题目列表页面
* @param
* @param
* @return void
* @exception/throws [违例类型] [违例说明]
* @see [类、类#方法、类#成员]
* @deprecated
*/
public String QuestionList(HttpServletRequest request, HttpServletResponse response){
String paperID = request.getParameter("paperID"); //试卷表Id
String questionTypeId = request.getParameter("questionTypeId");//题型id
String tableName = request.getParameter("tableName"); //表名
request.setAttribute("paperID",paperID );
request.setAttribute("questionTypeId",questionTypeId );
request.setAttribute("tableName", tableName);
return "/QuestionList";
}
1.html
这是一个编辑试卷的功能,页面中首先显示试卷的题型,然后点击题型可以进入到题目列表页。
<table id="dg" class="easyui-datagrid" title="编辑试题-显示试卷题型" style="height:65%;width:100%"
data-options="rownumbers:true,pagination:true,pageSize:5,pageList:[5,10,15,20],method:'get',toolbar:'#tb',
onClickRow:onClickRow">
<thead>
<tr>
<th field="map.paperID" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['paperID'];}">paperID</th>
<th field="map.questionTypeId" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['questionTypeId'];}">题型id</th>
<th field="map.tableName" width="70%" align="center" data-options="formatter:function(value, rec){return rec.map['tableName'];}">表名</th>
<th field="map.name" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['name'];}">题型</th>
</tr>
</thead>
</table>
<div id="tb" style="padding: 2px 5px;">
<a href="#" class="easyui-linkbutton" iconCls="icon-search" οnclick="view()">预览</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-undo" οnclick="back()">返回</a>
</div>
2.js
function onClickRow(rowNum,record){
$.messager.confirm('提示','是否要查看题目?', function (r) {
if(r){
var paperID = record.map.paperID;//试卷id
var questionTypeId = record.map.questionTypeId;//题型id
var tableName = record.map.tableName;//标明
//跳转到下一页QuestionList
window.location.href ="${pageContext.request.contextPath}/QuestionList?paperID=" + paperID
+ '&questionTypeId=' + questionTypeId + '&tableName=' + tableName;
}
});
}
点击行的哪里都能触发该事件
3.controller
@RequestMapping("/QuestionList")
/**
* 编辑试题,点击一种题型后,显示题目列表页面
* @param
* @param
* @return void
* @exception/throws [违例类型] [违例说明]
* @see [类、类#方法、类#成员]
* @deprecated
*/
public String QuestionList(HttpServletRequest request, HttpServletResponse response){
String paperID = request.getParameter("paperID"); //试卷表Id
String questionTypeId = request.getParameter("questionTypeId");//题型id
String tableName = request.getParameter("tableName"); //表名
request.setAttribute("paperID",paperID );
request.setAttribute("questionTypeId",questionTypeId );
request.setAttribute("tableName", tableName);
return "/QuestionList";
}