项目中遇到数据带回,即点击按钮会查询一个表格,选择表格中的一些数据,并把数据带回的原页面。这个功能只有加载表格要和数据库交互,带回时用easyui的方法就ok。项目需求是:根据题型、章节和难度等级到题库表中查询数据,弹出一个表格显示,选择数据后,点击添加,并把选择的数据带回到页面的一个表格中显示。
1.html
<!--弹出框-- - --------start------- -张晓-->
<div id="add" class="easyui-dialog" style="width: 55%;height:50%" closed="true">
<table id="dg2" class="easyui-datagrid" style="height:100%"
data-options="pagination:true,pageSize:5,pageList:[5,10,15,20],method:'get',toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th field="map.chapter" width="20%" align="center" data-options="formatter:function(value, rec){return rec.map['chapter'];}">章节</th>
<th field="map.questionTypeName" width="20%" align="center" data-options="formatter:function(value, rec){return rec.map['questionTypeName'];}">题型</th>
<th field="map.level" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['level'];}">难度</th>
<th field="map.score" width="10%" align="center" data-options="formatter:function(value, rec){return rec.map['score'];}">分数</th>
<th field="map.content" width="38%" align="center" data-options="formatter:function(value, rec){return rec.map['content'];}">试题内容</th>
<th field="map.questionTypeId" width="180" align="center" data-options="formatter:function(value, rec){return rec.map['questionTypeId'];}" hidden="true">题型id</th>
<th field="map.id" width="180" align="center" data-options="formatter:function(value, rec){return rec.map['id'];}" hidden="true">小题号</th>
</tr>
</thead>
</table>
<!-- 工具栏 -->
<div id="tb" style&#