- 注册时间
- 2015-12-3
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 29
- 精华
- 0
- 帖子
- 8
|
<include file="Public/header" />
<div class="mini-toolbar" style="padding:2px;border-bottom:0;">
<table style="width:100%;">
<tr>
<td style="width:100%;">
<a class="mini-button" iconCls="icon-addnew" onclick="addRow()" plain="true" tooltip="增加">增加</a>
<a class="mini-button" iconCls="icon-remove" onclick="removeRow()" plain="true" tooltip="删除">删除</a>
<span class="separator"></span>
<a class="mini-button" iconCls="icon-save" onclick="saveData()" plain="true" tooltip="保存">保存</a>
<a class="mini-button" iconCls="icon-reload" onclick="search()" plain="true" tooltip="刷新">刷新</a>
</td>
<td style="white-space:nowrap;">
<input id="searchKey" class="mini-textbox" emptyText="请输入来源" style="width:150px;" onenter="onKeyEnter"/>
<a class="mini-button" iconCls="icon-search" plain="true" onclick="search()" tooltip="查询">查询</a>
</td>
</tr>
</table>
</div>
<div class="mini-fit" >
<div id="datagrid" class="mini-datagrid" style="width:100%;height:100%;"
url="__CONTROLLER__/sourcesearch" idField="source_id"
allowResize="false" pageSize="30"
allowCellEdit="true" allowCellSelect="true" multiSelect="true"
editNextOnEnterKey="true"
editNextRowCell="true">
<div property="columns">
<div type="indexcolumn"></div>
<div type="checkcolumn"></div>
<div name="source_name" field="source_name" headerAlign="center" allowSort="true" width="150" >来源
<input property="editor" class="mini-textbox" style="width:100%;" />
</div>
<div name="create_time" field="create_time" width="120" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss" align="center" headerAlign="center">创建时间
</div>
<div name="update_time" field="update_time" width="120" allowSort="true" dateFormat="yyyy-MM-dd HH:mm:ss" align="center" headerAlign="center">修改时间
</div>
</div>
</div>
</div>
<script type="text/javascript">
mini.parse();
var grid = mini.get("datagrid");
grid.load();
function search() {
var searchKey = mini.get("searchKey").getValue();
grid.load({ searchKey: searchKey });
}
function onKeyEnter(e) {
search();
}
function addRow() {
var newRow = { _name: "New Row" };
grid.addRow(newRow, 0);
grid.beginEditCell(newRow, "LoginName");
}
function removeRow() {
var rows = grid.getSelecteds();
if (rows.length > 0) {
grid.removeRows(rows, true);
saveData();
}else {
mini.alert("请选中一条记录");
}
}
function saveData() {
var data = grid.getChanges();
var json = mini.encode(data);
grid.loading("保存中,请稍后......");
$.ajax({
url: "__CONTROLLER__/sourcesave",
data: { data: json },
type: "post",
dataType:"json",
async: false,
success: function (data) {
mini.alert(data.msg);
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
mini.alert(jqXHR.responseText);
}
});
}
grid.on("celleditenter", function (e) {
var index = grid.indexOf(e.record);
if (index == grid.getData().length - 1) {
var row = {};
grid.addRow(row);
}
});
</script>
<include file="Public/footer" /> |
|