Extjs4.0中的错误"this.getFullYear is not a function"解决
来源:互联网 发布:索尼mp3软件 编辑:程序博客网 时间:2024/04/28 10:49
这几天使用Extjs4.0中的MVC,遇到的一个问题。把问题记录下来,希望可以给大家带来帮助。
首先我使用的Extjs版本是4.0.2a,然后同时引用了“ext-lang-zh_CN.js”。之后我在FORM提交的时候,使用store.sync()方法将record中的参数提交到后台,代码如下:
Save: function(button){ var win = button.up('window'), form = win.down('form'), record = form.getRecord(), values = form.getValues(); if(typeof(record) != 'undefined'){ record.set(values); } else{ record = Ext.create('HB.model.YqInstrument'); record.set(values); record.set('InstrumentID',0); this.getYqInstrumentsStore().add(record); } win.close(); this.getYqInstrumentsStore().sync(); record.commit(); record.phantom=false; },
然后发现Extjs报错,“this.getFullYear is not a function”,一想,应该是日期控件Datefield的问题,于是到Form里看,发现Datefield显示的格式是"y年m月d日的格式",如下图:
原来是“ext-lang-zh_CN.js”的本地化文件把Datefield的值改成中文格式后,Extjs不认识它是日期对象了。所以就报错“this.getFullYear is not a function”。
解决方法是:
修改“ext-lang-zh_CN.js”文件中的
if(Ext.form.field.Date){ Ext.apply(Ext.form.field.Date.prototype, { disabledDaysText : "禁用", disabledDatesText : "禁用", minText : "该输入项的日期必须在 {0} 之后", maxText : "该输入项的日期必须在 {0} 之前", invalidText : "{0} 是无效的日期 - 必须符合格式: {1}", format : "y年m月d日"
}); }
为
if(Ext.form.field.Date){ Ext.apply(Ext.form.field.Date.prototype, { disabledDaysText : "禁用", disabledDatesText : "禁用", minText : "该输入项的日期必须在 {0} 之后", maxText : "该输入项的日期必须在 {0} 之前", invalidText : "{0} 是无效的日期 - 必须符合格式: {1}", format : "Y-m-d" // //如果datefield设置了这个,会导致报错“this.getFullYear is not a function”.. }); }
问题解决。
- Extjs4.0中的错误"this.getFullYear is not a function"解决
- UnCaught TypeError:date.getFullYear is not a function解决方案
- undefined is not a function错误解决
- ExtJS4 reader.read is not a function
- extjs中出现this.addevents is not a function错误
- extjs中出现this.addevents is not a function错误
- Ext.this.addEvents is not a function错误
- Ext this.addEvents is not a function错误原因
- Ext this.addEvents is not a function 错误原因
- Extjs 报this.addEvents is not a function错误原因
- 错误中学习--this.addEvents is not a function
- 如何解决Uncaught TypeError: this.setState is not a function
- ExtJs this.addevents is not a function
- this.setState is not a function
- 使用vue时Module build failed: TypeError: this._init is not a function错误的解决方法
- js错误: email() is not a function
- JS-”Undefined is not a function“错误
- fileupload is not a function 上传错误
- ARM资源免费下载——超级全面,力荐
- 如果乔布斯从苹果 CEO 位置上离开,苹果的未来将会如何?
- 乔布斯辞职信:苹果将迎来最具创新的时代
- 让你的旧电脑重获新生的5个Linux发行版
- javascript 内存泄露工具使用
- Extjs4.0中的错误"this.getFullYear is not a function"解决
- linux查看硬件配置的命令
- 史蒂夫的辞职信
- STL中比较常用的容器是vector,set和map,比较常用的算法有Sort等。
- 三种服务器类型外观以及优缺点
- S3C2416 增加 HIVE 注册表功能
- linux 下倒入导出数据库
- 转:如何诊断Windows CE的应用程序崩溃
- 专家指导 UML类图关系表示方法