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 ...
随机推荐
- mysql 分组条件筛选
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | t ...
- NIO Channel Scatter/Gather 管道Pipe类
通道提供了一种被称为Scatter/Gather的重要新功能(有时也被称为矢量I/O).Scatter/Gather是一个简单却强大的概念,它是指在多个缓冲区上实现一个简单的I/O操作.对于一个wri ...
- 刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1
目录 刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1 解题过程 刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1 题目复现链接:https:/ ...
- mysql事务回滚机制概述
应用场景: 银行取钱,从ATM机取钱,分为以下几个步骤 1 登陆ATM机,输入密码: 2 连接数据库,验证密码: 3 验证成功,获得用户信息,比如存款余额等: 4 用 ...
- IIS 7中添加FTP站点并设置指定用户访问
1. 开启 FTP 和 IIS 服务功能: 2. 添加新用户: 打开计算机管理界面: 展开“本地用户与组”: 邮件点击“用户”->点击“创建新用户”: 在创建新用户对话框输入用户 ...
- axios post 400 状态码
1.400状态码 400的主要有两种形式: (1).bad request意思是“错误的请求": (2).invalid hostname意思是"不存在的域名”. 2.axio ...
- tar加密码
tar -zcvf - *** | openssl des3 -salt -k pass | dd of=.his dd if=.his | openssl des3 -d -k pass| tar ...
- tar_ssh 配合下载文件(适合于带宽充足传输大量小文件场景)
局域网网速快,但是当要传输大量小文件时倘若仍然使用scp,由于每个文件传输完毕都需要独立进行传输完毕的确认,这样就无法充分利用带宽.一方面等待确认时tcp窗口无法填满,另一方面文件传完之前确认也不会开 ...
- 使用bert进行情感分类
2018年google推出了bert模型,这个模型的性能要远超于以前所使用的模型,总的来说就是很牛.但是训练bert模型是异常昂贵的,对于一般人来说并不需要自己单独训练bert,只需要加载预训练模型, ...
- svg复用方式<g>, <defs>, <symbol>, <use>
svg复用元素的方式主要有 <g>, <defs>, <symbol>, <use> 1. <g> group, 分组,定义一组元素,初始不 ...