日期:2014-05-16 浏览次数:20438 次
<script type="text/javascript">
function edit(index) {
$("#gridlist").datagrid("beginEdit", index);
var ed = $("#gridlist").datagrid("getEditor", {
index : index,
field : "LOWER_LIMIT"
});
$(ed.target).focus();
}
function cancel(index) {
// $("#gridlist").datagrid("endEdit", index);
// $("#gridlist").datagrid("rejectChanges");
$("#gridlist").datagrid("cancelEdit",index);
}
$(function(){
var p_height = $('.div_panel').parent().height();
$('.div_panel').height(p_height - 90);
$('.div_panel_search').height(75);
var grid = new easyui.datagrid({
title:"商品列表",
renderer:"gridlist",
idField:"GOODS_ID",
onBeforeEdit:function(index,row) {
row.editing = true;
$('#gridlist').datagrid('refreshRow',index);
},
columns:[[
{title:"物品ID",field:"GOODS_ID",width:30,hidden:true},
{title:"库存警戒值",field:"LOWER_LIMIT",width:100,align:"center",editor:"numberbox"},
{title:"操作",field:"opera",width:120,align:"center",formatter:
function(value,row,index) {
if(row.editing) {
var s = "<a href='#' onclick='save(" + index + ")'>保存</a>";
var c = "<a href='#' onclick='cancel(" + index + ")'>取消</a>";
return s + " " + " " + c;
} else {
var e = "<a href='#' onclick='edit(" + index + ")'>编辑</a>";
var c = "<a href='#' onclick='cancel(" + index + ")'>取消</a>";
return e + " " + " " + c;
}
}
},
]],/*columns*/
});
// 获取商品明细
function getGoodsDetailList() {
...;
grid.load(url,param);
};
getGoodsDetailList();
});
</script>