Cannot read property 'field' of undefined (at _8 (jquery.numberbox.js:33))
问题描述:
页面端用了easyui的numberbox属性,然后在用js的方法修改值的时候,明明看到页面中的值是数字型(数量字段),
但是就是会报错
这种错误真的是很难理解,不过经过我的debug跟了一下,发现了问题所在,虽然页面中看到的是数字,但是在js代码中,赋值的时候,这个变量成了string类型了
很明显的发现,这个ProductQty的值是string了。
function ProductQty(newValue,oldValue) {
if(newValue && oldValue && newValue != oldValue) {
var row = $('#gridlist').datagrid('getSelected');
var index = $('#gridlist').datagrid('getRowIndex',row);
row.ProductQty = newValue;
row.SalePrice = row.ProductQty * row.OriginalPrice * (row.DiscountRate / 10);
$('#gridlist').datagrid('updateRow', {index: index, row: row});
$('#gridlist').datagrid('endEdit',index);
$('#gridlist').datagrid('beginEdit',index);
countPoint();
}
}
文件里标红的部分,发现了这个row对象里的ProductQty这个值变成了string类型了。
解决办法就是给这个转成Number即可
row.ProductQty = Number(newValue);
Cannot read property 'field' of undefined (at _8 (jquery.numberbox.js:33))的更多相关文章
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...
- jquery升级到新版本报错[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法(转)
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property 'msie' of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...
- 一个关于EasyUI超恶心的BUG。。。Cannot read property 'options' of undefined
控制台Console抛出的异常: jquery.easyui.min.js:9148 Uncaught TypeError: Cannot read property 'options' of und ...
- Cannot read property ‘msie’ of undefined错误原因以及解决方案
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,$.browser这个api从 ...
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 --转
初用Yii的srbac模块.出现 Cannot read property ‘msie’ of undefined 错误.上网查询,找到如下的文章.使用文末的打补丁的方法,成功搞定.感谢. ===== ...
- 微信小程序跳转web-vie时提示appId无法读取:Cannot read property 'appId' of undefined
微信小程序报web-view错无法读取appId:Cannot read property 'appId' of undefined 问题描述: 我以前一直如下写代码没报错也都是可以使用的,并且小程序 ...
- UEditor使用报错Cannot set property 'innerHTML' of undefined
仿用UEditor的setContent的时候报错,报错代码如下Uncaught TypeError: Cannot set property ‘innerHTML’ of undefined.调试u ...
- AngularJs Type error : Cannot read property 'childNodes' of undefined
参考博客: https://blog.csdn.net/u011127019/article/details/73087868 在AngularJs和JQuery插件共存咋项目中经常会遇到如下异常 T ...
- Odoo14 TypeError: Cannot read property 'classList' of undefined
Traceback: TypeError: Cannot read property 'classList' of undefined at Class.setLocalState (http://l ...
随机推荐
- Java算法求最大最小值,倒序,冒泡排序,斐波纳契数列,日历一些经典算法
一,求最大,最小值 int[] a={21,31,4,2,766,345,2,34}; //这里防止数组中有负数,所以初始化的时候给的数组中的第一个数. int max=a[0]; int min=a ...
- git命令行操作详解
目录 1.常用操作 1.1 新建代码库 1.2 配置 1.3 remote管理 1.4 添加和撤销操作 1.5 代码提交 1.6 分支操作 1.7 查看信息 1.8 pull操作 1.9 push操作 ...
- 大数据服务大比拼:AWS VS. AzureVS.谷歌
[TechTarget中国原创] 对于企业用户来说,大数据服务是一项较具吸引力的云服务.三大巨头AWS.Azure以及谷歌都在力争夺得头把交椅,但是最后到底是哪一家能够取得王座之战的胜利呢? 云市场正 ...
- shell脚本批量下载资源并保留路径
示例资源列表 如url.txt: http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png http://su.bdimg.co ...
- Git上手:Git扫盲区
Git 自述Git 是由伟大的电脑程序员Linus Torvalds编写的一个开源的,分布式的版本控制系统软件. Git 核心原理Git 利用底层数据结构,通过指向索引对象的可变指针,保存文件快照. ...
- 每天一个Linux命令(3):ls命令
ls命令用来显示目标列表,在Linux中是使用率较高的命令.ls命令的输出信息可以进行彩色加亮显示,以分区不同类型的文件. 语法 ls(选项)(参数) 选项 -a:显示所有档案及目录(ls内定将档案名 ...
- canda 常用命令
1.获取版本 conda -V conda --version 2.获取帮助 conda -h conda --help 查看某一命令的帮助 conda install -h conda instal ...
- finally在return之后还是之前运行
finally在运行前打印出来是return的数据,finally是最后修改的数据,如果finally存在对返回值的修改,则以finally修改的值为准. 综上所述,finally最后运行.
- iframe 如何让它展现内容自适应高度
引用: <iframe id="ifm1" runat="server" src="/comment/page1?id=@productId&q ...
- heat模板
Heat 目前支持两种格式的模板,一种是基于 JSON 格式的 CFN 模板:另外一种是基于 YAML 格式的 HOT 模板.CFN 模板主要是为了保持对 AWS 的兼容性.HOT 模板是 Heat ...