您的位置:首页 > 产品设计 > UI/UE

easyUI 设置列可编辑

2016-03-18 10:21 766 查看
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];

//対象行の"設備編集フラグ"が1の場合、編集可

if (field=="defectQtyBranch"){

return true;

}

}

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: