DevExtreme学习笔记(一) DataGrid中数据提交注意事项
1.数据提交的{}数据需转化json格式
syncPost('/controller/action', { values: JSON.stringify({d:x}) }, function (res) {
if (res.Data&&res.Data.Status || res.Status) {
E('PopupContainer').dxPopup('instance').hide();
if (E(gridId).html().length > 0) {//
E(gridId).dxDataGrid('instance').refresh();
}
} else {
errNotify("重复添加");
}
}, function (err) {
errNotify("不能重复添加");
});
2.时间控件联动写法
window.startDateBox = $('#start').dxDateBox({
acceptCustomValue: false,
displayFormat: __DateFormat,
min: window.startDate,//限定时间值
onValueChanged: function (e) {
E('end').dxDateBox('instance').option("min", e.component.option("value"));//开始时间选择变化结束时间的最小值修改
}
}).dxDateBox('instance');
window.endDateBox = $('#end').dxDateBox({
acceptCustomValue: false,
displayFormat: __DateFormat,
max: window.endDate//限定时间值
}).dxDateBox('instance');
3.popup自定义弹出配置
var popup = dxConfig.popup("选择信息");
popup.width = 900;
popup.height = 600;
popup.contentTemplate = function (container) {
var grid = initGrid("/getinfo", "popup_info", cityid, 2);//popup_info跟下面追加的div的id对应
container.append($('<div id="popup_info"/>').css({ "height": "90%" }).dxDataGrid(grid));
container.append($('<div id="plan-form"><div class="dx-fieldset" >\
<div class="row"><div class="col-sm-4 col-lg-4"> <div class="dx-field">\
<div class="dx-field-label">内容</div>\
<div class="dx-field-value" style="margin-left:-10%;width:70%; border:1px solid #eee;">\
<input autocomplete="off" readonly class="dx-texteditor-input" role="textbox" type="text" id="name">\
</div></div> </div>\
<div class="col-sm-4 col-lg-4"><div class="dx-field">\
<div class="dx-field-label">开始日期</div>\
<div class="dx-field-value">\
<div id="start"></div>\
</div></div></div>\
<div class="col-sm-4 col-lg-4">\
<div class="dx-field">\
<div class="dx-field-label">结束日期</div>\
<div class="dx-field-value"> <div id="end"></div>\
</div></div></div>\
</div></div ></div >'));
};//弹出框中添加确定和取消按钮
popup.toolbarItems = [
{
toolbar: 'bottom',
widget: 'dxButton',
options: {
text: '确定',
elementAttr: {
'style': 'background-color:#1BBC9B;color:white;'
},
icon: 'fa fa-save',
hoverStateEnabled: true,
onClick: function (e) {
var StartDate = window.startDateBox._options.value ? startDateBox._options.value : null;
var EndDate = window.endDateBox._options.value ? endDateBox._options.value : null;
var stagename = $("#name").val();
if (!stagename) {
errNotify("请选择内容");
return;
}
if (!StartDate) {
errNotify("请选择开始时间");
return;
}
if (!EndDate) {
errNotify("请选择结束时间");
return;
}
window.SelectAddData.StartDate = StartDate;
window.SelectAddData.EndDate = EndDate;
syncPost('/controller/Insert', { values: JSON.stringify({d:x}) }, function (res) {
if (res.Data&&res.Data.Status || res.Status) {
E('PopupToolsContainer').dxPopup('instance').hide();
if (E(gridId).html().length > 0) {//
E(gridId).dxDataGrid('instance').refresh();
}
} else {
errNotify("该不能重复添加");
}
}, function (err) {
errNotify("不能重复添加");
});
//if (typeof (fn) == "function")
// fn(e);
//E('PopupToolsContainer').dxPopup('instance').hide();
}
},
location: 'after'
}, {
toolbar: 'bottom',
widget: 'dxButton',
options: {
text: '取消',
icon: 'fa fa-undo',
hoverStateEnabled: true,
onClick: function () {
E('PopupToolsContainer').dxPopup('instance').hide();
}
},
location: 'after'
}
];
popup.onHidden = function () {
if (typeof hiddenFunc == "function") hiddenFunc();
}
E("PopupToolsContainer").dxPopup(popup);
4.HttpGet传递数组参数,url会转换为以,号分割的字符串可后台转换为数组变例
DevExtreme学习笔记(一) DataGrid中数据提交注意事项的更多相关文章
- DevExtreme学习笔记(一) DataGrid中数据筛选
config.filterRow = { visible: true, applyFilter: "auto" }; config.headerFilter = { visible ...
- DevExtreme学习笔记(一) DataGrid中MVC分析
@(Html.DevExtreme().DataGrid() .ID("gridContainer") .DataSource(d => d .OData() .Url(&q ...
- DevExtreme学习笔记(一) DataGrid中注意事项
1.阻止cell编辑 config.onEditorPreparing = function (e) { if (e.dataField === 'xx' && e.row.data. ...
- DevExtreme学习笔记(一) DataGrid中js分析
1.overviewjs采用 $(function() { $("#gridContainer").dxDataGrid({ dataSource: { store: { type ...
- CockroachDB学习笔记——[译]CockroachDB中的SQL:映射表中数据到键值存储
CockroachDB学习笔记--[译]CockroachDB中的SQL:映射表中数据到键值存储 原文标题:SQL in CockroachDB: Mapping Table Data to Key- ...
- R学习笔记(4): 使用外部数据
来源于:R学习笔记(4): 使用外部数据 博客:心内求法 鉴于内存的非持久性和容量限制,一个有效的数据处理工具必须能够使用外部数据:能够从外部获取大量的数据,也能够将处理结果保存.R中提供了一系列的函 ...
- .NET MVC 学习笔记(六)— 数据导入
.NET MVC 学习笔记(六)—— 数据导入 在程序使用过程中,有时候需要新增大量数据,这样一条条数据去Add明显不是很友好,这时候最好就是有一个导入功能,导入所需要的数据,下面我们就一起来看一下导 ...
- Kotlin学习笔记(9)- 数据类
系列文章全部为本人的学习笔记,若有任何不妥之处,随时欢迎拍砖指正.如果你觉得我的文章对你有用,欢迎关注我,我们一起学习进步! Kotlin学习笔记(1)- 环境配置 Kotlin学习笔记(2)- 空安 ...
- openresty 学习笔记二:获取请求数据
openresty 学习笔记二:获取请求数据 openresty 获取POST或者GET的请求参数.这个是要用openresty 做接口必须要做的事情.这里分几种类型:GET,POST(urlenco ...
随机推荐
- Net core学习系列(三)——Net Core中的依赖注入
本文通过一个维修工与工具库的例子形象的描述一下为什么要用依赖注入.它的工作原理是什么样的, 然后根据这个类比一下ASP.NET Core 中的依赖注入, 从而深刻了解它的使用方法.注意事项以及回收机制 ...
- 第2课第5节_Java面向对象编程_异常_P【学习笔记】
摘要:韦东山android视频学习笔记 java的异常处理的原则如下: 1.我们先写一个没有对异常处理的程序,在进行除法运算的时候,除数是非零的话,运行时没有问题的,但是除数为零的时候,运行就会有问 ...
- 最稳定万能vip视频解析接口 支持HTTPS
最稳定万能vip视频解析接口 支持HTTPS https://cdn.yangju.vip/k/?url=后面加上播放的地址即可 https://cdn.yangju.vip/k/?url= http ...
- MySQL索引知识点及面试常问题
索引的功能 索引可以大幅增加数据库的查询的性能,在实际业务场景中,或多或少都会使用到. 但是索引是有如下 2 个代价的: 需要额外的磁盘空间来保存索引 对于插入.更新.删除等操作由于更新索引会增加额外 ...
- matlab学习笔记10_4MATLAB中的字符串表示
一起来学matlab-字符串操作 10_4 MATLAB中的字符串表示 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考书籍 <matlab 程序设计与综合应用>张德丰等著 感 ...
- springboot 整合mongodb
Mongodb Mongodb是为快速开发互联网Web应用而构建的数据库系统,其数据模型和持久化策略就是为了构建高读/写吞吐量和高自动灾备伸缩性的系统. 在pom.xml中添加相关依赖 <!-- ...
- 解决EasyDSS、EasyNVR流媒体RTMP、HLS(m3u8)、HTTP-FLV播放提示H5播放错误的问题
背景介绍 EasyDSS流媒体解决方案提供的是一站式的转码.点播.直播.录像.检索.时移回放服务,它的出现极大地简化了开发和集成的工作,基于其强大的后台管理能力,支持多种特性需求,完全能够满足企业视频 ...
- 【Python开发】C和Python之间的接口实现
作者:Jerry Jho 链接:https://www.zhihu.com/question/23003213/answer/56121859 ## 更新:关于ctypes,见拙作 聊聊Python ...
- Windows网络命令的相关指令(1)
1.Ipconfig 该命令可以检查网络接口配置.如果用户系统不能到达远程主机,而同一系统的其他主机可以到达,那么用该命令对这种故障进行判断是有必要的.当主机能到达远程主机但不能到达本网主机时,则表示 ...
- matlab调试时子函数断点不起作用
matlab调试代码时总是遇到这样一个奇怪的问题,就是当我在主程序(.m脚本)中调用子函数并在子函数中设置断点,然后开始调试运行主程序... 发现主程序直接运行到结束而并没有在调用子函数的时候在所设置 ...