1:引入easyui 包
<script type="text/javascript" src="script/jquery-easyui-1.4.4/datagrid-cellediting.js"></script>
2:设置editor:“text”
$('#workTime').textbox('textbox').css({"background-color":"#FFFACD"});
$.ajax({
url : "uD0650Action!initSearch.action",
type : "POST",
data : {},
success : function(data, textStatus) {
var jsonObj = JSON.parse(data);
/* if("1"==jsonObj['updateType']){
$('#delete').linkbutton('disable');
}else if("2"==jsonObj['updateType']) {
$('#delete').linkbutton('able');
} */
$("#oprType").val(jsonObj.oprType);
$("#updateType").val(jsonObj.updateType);
$('#oprInstQty').textbox('setValue', jsonObj.oprInstQty);
$('#oprInputQty').textbox('setValue', jsonObj.oprInputQty);
$('#workTime').textbox('setValue', jsonObj.workTime);
$('#searchResultList').datagrid({
data:jsonObj.searchResultList,
fit:true,
nowrap:true,
fitColumns:true,
striped:true,
idField:'defectReasonCd',
columns:[[
{field:'defectReasonCd',title:'<s:text name="Expj.DEFECT_CAUSE_CD"/>',width:115,height:30,align:'center'},
{field:'defectCause',title:'<s:text name="Expj.DEFECT_CAUSE"/>',width:80,align:'center'},
{field:'defectQtyBranch',title:'<s:text name="Expj.DEFECTIVE_QTY_1"/>',align:'center',editor:'text'}
]]
});
3:设置
$('#searchResultList').datagrid('enableCellEditing');
$('#searchResultList').datagrid({
onBeforeCellEdit: function (index, field) {
var row = $(this).datagrid('getRows')[index];
if (field=="defectQtyBranch"){
return true;
}
}
});
easyUI 设置列可编辑
最新推荐文章于 2022-05-20 13:49:48 发布