这两天刚开始接触easyUI,因为工作原因,我一个后台开发被前端折磨够呛~~~
html
<div style="float:right;width:69%;height:400px;margin-bottom: 150px;">
<div >缴费金额</th>
</tr>
</thead>
</table>
</div>
</div>
<div >
var editIndex = undefined;
function endEditing(){
if (editIndex == undefined){return true}
if ($('#glGrid').datagrid('validateRow', editIndex)){
var ed = $('#glGrid').datagrid('getEditor', {index:editIndex,field:'projectAmt'});
var projectAmt = $(ed.target).combobox('getText');
$('#glGrid').datagrid('getRows')[editIndex]['projectAmt'] = projectAmt;
$('#glGrid').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
function onClickRow(index){
if (editIndex != index){
if (endEditing()){
$('#glGrid').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#glGrid').datagrid('selectRow', editIndex);
}
}
}
function removeit(){
if (editIndex == undefined){return}
$('#glGrid').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
function accept(){
if (endEditing()){
$('#dg').datagrid('acceptChanges');
}
}
function getChanges(){
var rows = $('#glGrid').datagrid('getChanges');
alert(rows.length+' rows are changed!');
}
</script>
js
(function($) {
var busMng = rmtCMHelper.createBusMngInst({
busMngOptions: {
project_add: function () {
$('#seleteProject').window({
width: 600,
height: 450,
title: '选择...',
minimizable: false,
maximizable: false,
collapsible: false,
modal: true
});
$('#seleteProject').window('open');
var ctx = $("#ctx").val();
var accountId = $("#accountId").val();
$('#project').datagrid({
url: ctx + '/wisdom/paymentProject/getProData.html',
width: "100%",
height: '400px',
striped: true,
loadMsg: '正在加载学生的信息...',
pagination: true,
pageSize: 10,
pageNumber: 1,
pageList: [10, 20, 30],
queryParams: {"wxSchoolWisdomPaymentProject.accountId": accountId},
columns: [[
{field: 'ck', checkbox: true, align: 'center', width: 50},
{field: 'projectNo', width: 150,align: 'center', title: '项目编号'},
{field: 'projectName', width: 150,align: 'center', title: '项目名称'},
{field: 'projectAmt', width: 150,align: 'center', title: '项目金额'},
]]
});
},
}
});
}
//实现添加入新的datagrid
function selectPro() {
var rows = $('#project').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
$("#glGrid").datagrid('appendRow',
{projectNo:rows[i].projectNo,
projectName:rows[i].projectName,
projectAmt:rows[i].projectAmt,
});
}