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;
}
}
});
<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;
}
}
});
相关文章推荐
- 《iOS Human Interface Guidelines》——Table View
- 亲测:NGUI不规则按钮实现 !!!!
- 程序之间数据的共享,UIActivityViewController类让你的程序进入AirDrop列表
- IOS控件学习之UIScrollView(5)
- 自定义UIButton一般方法
- [Sencha ExtJS & Touch] Ext类结构中的requires和uses
- UI控件--EditText
- 在iOS 8中使用UIAlertController
- iOS开发--UISwitch用法
- iOS开发--UISwitch用法
- [转]UIStepper
- easyui 中怎么修改主题
- IOS控件学习之UIScrollView(4)
- 1.3:Union-Find算法-----quick-union算法的改进(加权的quick-union算法)
- iOS开发:XIB之UITableView自定义cell
- UI随设备旋转从ios6到ios8的适配
- easyui中的datagrid组件前台分页刷新但是数据不刷新
- UITableViewController
- mean value coordinates
- JMS的简单使用