javascript - 如何在 jsGrid 中自定义验证器警报?
问题描述
我找不到在 jsGrid 中自定义验证器警报的方法。我可以更改验证规则,但我需要使用自定义函数并删除警报。
我也找不到对输入的无效数据的引用!消息,这是required
警报中的默认值。
我尝试遵循 github 中一些主题的一些提示,我也按照文档使用invalidNotify
,但没有成功。
我正在尝试使用自定义函数,它除了验证已经在布局中进行了一些更改以通知插入的数据无效。
但是,标准的 jsGrid 警报不断弹出,如下所示:
fields: [{
name: "sensorNumber",
title: $('#title_meter_number').val(),
type: "number",
validate: function(config) {
if (config == undefined) {
__validateRefuelling(config);
}
解决方案
我得到了它invalidNotify
,我以前错误地使用过它,它遵循我的代码:
var xxx = function() {
$('#xxx').jsGrid({
height: '250px',
width: '100%',
inserting: true,
editing: true,
sorting: true,
invalidNotify: function(args) {
$('#alert-error-not-submit').removeClass('hidden');
},
fields: [{
name: "sensorNumber",
title: $('#title_meter_number').val(),
type: "number",
validate: "required"
}, {
name: "liters",
title: $('#title_liters').val(),
type: "number",
validate: "required"
}, {
name: "measuredValue",
title: $('#title_indication_of_the_meter').val(),
type: "number",
validate: "required"
}, {
type: "control"
}]
});
};
推荐阅读
- reactjs - React - getDerivedStateFromProps - 字段值将加载道具但不会改变
- c++ - 在 c++ 中使用 printf 时出错,无法打开 LNK1104 exe 文件
- opencv - 使用opencv检测形状位置和航向
- python - 如何根据满足某些条件的现有文件创建和重新排列新的 csv 文件?
- python-3.x - 从 App Engine 的 python 代码将数据插入 Cloud SQL for MySQL
- jupyter-notebook - 在 AWS Sagemaker 上安装 Jupytext 插件
- java - 如何使用类?
- angular - 如何强制更新托管在 Firebase 上并与 FireStore 一起使用的无服务器 Angular SPA PWA
- c++ - C++:处理许多配置变量的设计建议
- javascript - 根据 localStorage 有条件地渲染组件