问题描述:

页面端用了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))的更多相关文章

  1. [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法

    最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...

  2. jquery升级到新版本报错[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法(转)

    最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property 'msie' of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...

  3. 一个关于EasyUI超恶心的BUG。。。Cannot read property 'options' of undefined

    控制台Console抛出的异常: jquery.easyui.min.js:9148 Uncaught TypeError: Cannot read property 'options' of und ...

  4. Cannot read property ‘msie’ of undefined错误原因以及解决方案

    最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,$.browser这个api从 ...

  5. [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 --转

    初用Yii的srbac模块.出现 Cannot read property ‘msie’ of undefined 错误.上网查询,找到如下的文章.使用文末的打补丁的方法,成功搞定.感谢. ===== ...

  6. 微信小程序跳转web-vie时提示appId无法读取:Cannot read property 'appId' of undefined

    微信小程序报web-view错无法读取appId:Cannot read property 'appId' of undefined 问题描述: 我以前一直如下写代码没报错也都是可以使用的,并且小程序 ...

  7. UEditor使用报错Cannot set property 'innerHTML' of undefined

    仿用UEditor的setContent的时候报错,报错代码如下Uncaught TypeError: Cannot set property ‘innerHTML’ of undefined.调试u ...

  8. AngularJs Type error : Cannot read property 'childNodes' of undefined

    参考博客: https://blog.csdn.net/u011127019/article/details/73087868 在AngularJs和JQuery插件共存咋项目中经常会遇到如下异常 T ...

  9. Odoo14 TypeError: Cannot read property 'classList' of undefined

    Traceback: TypeError: Cannot read property 'classList' of undefined at Class.setLocalState (http://l ...

随机推荐

  1. 通俗版解释网关,IP地址,ARP欺骗,DDOS攻击

    计算机主机网关的作用是什么? 假设你的名字叫小不点,你住在一个大院子里,你的邻居有很多小伙伴,在门口传达室还有个看大门的李大爷,李大爷就是你的网关.当你想跟院子里的某个小伙伴玩,只要你在院子里大喊一声 ...

  2. Postman-简单使用(1)

    Postman-简单使用(1) Postman-简单使用 Postman-进阶使用 Postman-CI集成Jenkins Postman功能(https://www.getpostman.com/f ...

  3. Windows Server 2012 新特性:IPAM的配置

    Windows Server 2012 中的 IPAM 是一个新增的内置框架,用于发现.监视.审核和管理企业网络上使用的 IP 地址空间.IPAM 可以对运行动态主机配置协议 (DHCP) 和域名服务 ...

  4. 《Cracking the Coding Interview》——第16章:线程与锁——题目5

    2014-04-27 20:16 题目:假设一个类Foo有三个公有的成员方法first().second().third().请用锁的方法来控制调用行为,使得他们的执行循序总是遵从first.seco ...

  5. 《Cracking the Coding Interview》——第9章:递归和动态规划——题目6

    2014-03-20 03:27 题目:输出所有由N对括号组成的合法的括号序列.比如n=2,“()()”.“(())”等等. 解法:动态规划配合DFS,应该也叫记忆化搜索吧.一个整数N总可以拆成若干个 ...

  6. USACO Section2.3 Money Systems 解题报告 【icedream61】

    money解题报告------------------------------------------------------------------------------------------- ...

  7. nginx配置及HTTPS配置示例

    一.nginx简单配置示例 user www www; worker_processes ; #error_log logs/error.log; #error_log logs/error.log ...

  8. ymal

    https://blog.csdn.net/beginya/article/details/76768968 https://www.jianshu.com/p/97222440cd08

  9. CodeForces-757B Bash's Big Day

    题目链接 https://vjudge.net/problem/CodeForces-757B 题目 Description Bash has set out on a journey to beco ...

  10. ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

    这是在python中使用caffe产生的错误. 程序很普通: #-*-coding=utf-8-*- import numpy as npimport matplotlib.pyplot as plt ...