1.阻止cell编辑

config.onEditorPreparing = function (e) {
if (e.dataField === 'xx' && e.row.data.Id) {//判断是否是某一列
e.cancel = true;
return;
}
};

2.配置子项

config.masterDetail = {
enabled: true,
template: function (container, info) {
var detailConfig = getProjectContactsConfig(info.data);//JSON.stringify(info.data)
detailConfig.masterRow = info.data;//缓存父级row对象给detailGrid
detailConfig.gridId = 'master-grid-Proj-' + info.data.Id;
var $grid=$('<div id="' + detailConfig.gridId +'">').dxDataGrid(detailConfig);
detailConfig.component = $grid.dxDataGrid('instance');//$(detailConfig.gridSelector).dxDataGrid('instance');
$grid.appendTo(container);
}
};

  3.编辑新行注意事项和选中行事件

config.onInitNewRow = function (e) {
e.data.ProjId = row.Id;
};//编辑新行时父Id赋值 config.onRowClick = function (e) {
if (e.rowType !== "totalFooter") {
e.component.selectRows();
e.component.selectRowsByIndexes(e.component.getRowIndexByKey(e.key));
}
};//选中行事件

4.第一行选中

config.onContentReady = function (e) {
//默认选中控件第一行
if (e.component.getVisibleRows().length > 0)
e.component.selectRows(e.component.getVisibleRows()[0].key);
};

5.时间值可编辑时要在config初始化时格式转换

var config = dxConfig.editGrid({
url: '/XXX',
id: id,
onLoaded: function(res) {
if (res.data.data) {
$.each(res.data.data, function(rIndex, rRow) {
if (rRow && rRow.StartDate) rRow.StartDate = T(rRow.StartDate, __DateFormat);
if (rRow && rRow.EndDate) rRow.EndDate = T(rRow.EndDate,__DateFormat);
});
}
}});//其中的__DateFormat是时间格式YYYY/MM/DD等

6. 字段下拉设置

{
dataField: "SupProjId",
caption: "xxx",
allowSorting: false,
allowHeaderFiltering: false,
alignment: "left",
editorOptions: {
showClearButton: true,
valueExpr: "Value",//选中值
displayExpr: "Text"//显示值
},
cellTemplate: function (ele, info) {
if (info.data) {
ele.html(info.data.Name);//显示值
}
}

  3.编辑模式:

config.editing.mode = 'batch';//可多行编辑右上角含保存按钮,保存后按钮不可编辑,只有内容更改时可保存
config.editing.mode = 'cell';列编辑可直接保存

config.editing.mode = 'form';//表单编辑

config.editing.mode = 'popup';弹出编辑
editing: {
mode: "popup",
allowUpdating: true,
popup: {
title: "Employee Info",
showTitle: true,
width: 700,
height: 525,
position: {
my: "top",
at: "top",
of: window
}
},
form: {
items: [{
itemType: "group",
colCount: 2,
colSpan: 2,
items: ["FirstName", "LastName", "Prefix", "BirthDate", "Position", "HireDate", {
dataField: "Notes",
editorType: "dxTextArea",
colSpan: 2,
editorOptions: {
height: 100
}
}]
}, {
itemType: "group",
colCount: 2,
colSpan: 2,
caption: "Home Address",
items: ["StateID", "Address"]
}]
}
}

  

edtingmode='row'//行编辑

  

 

  

最新文章

  1. 一些linux包相关命令
  2. 第三节:Vue计算属性
  3. Android -- 简单广播接收与发送(2)--动态注册广播接收器
  4. Spring 核心概念以及入门教程
  5. Qt之QComboBox(基本应用、代理设置)(转)
  6. jsonp的后台怎么返回去数据
  7. maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
  8. Redis学习记录之————微博项目
  9. python3控制路由器--使用requests重启极路由.py
  10. windows cmd: 打开windows系统程序或服务的常见命令
  11. DropDownList单选与多选下拉框
  12. arcgis api for js热力图优化篇-不依赖地图服务
  13. js获取样式、currentStyle和getComputedStyle的兼容写法
  14. spring cloud config svn仓库配置
  15. AngularJS--及其他js框架对比
  16. Gym 101149L Right Build
  17. 阿里云mysql数据库备份还原
  18. ajax实现输入用户名异步提示是否可用
  19. IDEA git修改远程仓库地址
  20. set_magic_quotes_runtime

热门文章

  1. python学习笔记二:(python3 logging函数中format说明)
  2. 【python】学习笔记之遇到的坑print输出报错
  3. 卷积神经网络CNN学习笔记
  4. spring-JDBC模板
  5. opendaylight+sfc 发送测试流量报错找不到SFF Name
  6. 第06组 Alpha事后诸葛亮
  7. 第06组 Beta冲刺(3/5)
  8. Linux_CentOS中的MySQL 数据库的安装调试、远程管理
  9. sass、less和stylus 相同与不同
  10. js 二叉树算法