EXTJS4.0 datefield时间控件更改为获取服务器时间
来源:互联网 发布:seo软优化方案 编辑:程序博客网 时间:2024/05/17 19:18
EXTJS4.0 datefield时间控件更改为获取服务器时间
- var fs = Ext.create('Ext.form.Panel', {
- region : 'north',
- frame : true,
- bodyStyle : 'padding:4px 2px 3px 4px',
- width : document.body.clientWidth,
- fieldDefaults : {
- labelAlign : 'left',
- msgTarget : 'side'
- },
- items : [ {
- xtype : 'container',
- anchor : '100%',
- layout : 'column',
- items : [ {
- xtype : 'container',
- columnWidth : .2,
- layout : 'anchor',
- defaultType : 'datefield',
- items : {
- fieldLabel : '日期',
- anchor : '90%',
- id:'time',
- format : 'Y-m-d',
- timePicker : true,
- editable : false,
- allowBlank : false,
- //value : Ext.Date.add(new Date(), Ext.Date.DAY, 1),
- listeners : {
- 'change' : specchangedatefun
- }
- }
- } ]
- } ]
- });
- value : Ext.Date.add(new Date(), Ext.Date.DAY, 1),
会默认获取当前浏览器所在机器的时间,所以如果用户主动更改时间的话,会有些许问题
在页面开始加载的时候 我就先获取服务器的时间 然后传到前台 给前台的日期控件赋值
- Ext.Ajax.request( {
- timeout : 3000,
- url : 'getdate.action',
- success : function(response, config) {
- json = Ext.JSON.decode(response.responseText);
- var date=new Date(json.date);
- var d=Ext.Date.add(date,Ext.Date.DAY, 1)
- Ext.getCmp('time').setValue(d);
- },
- failure : function(response,options) {
- }
- })//Ajax end
如果遇到出现什么getFullYear的错误的话 可以先把 上面注释掉的value赋值语句释放掉,无大碍,顶多就是用浏览器的时间先赋值一次 代码再用服务器的时间来一次
- EXTJS4.0 datefield时间控件更改为获取服务器时间
- EXTJS4.0 datefield时间控件更改为获取服务器时间
- Extjs4 获取datefield时间格式问题
- Extjs4 获取datefield时间格式问题
- Extjs4 获取datefield时间格式问题
- ExtJS4 日历控件datefield 解决选择时间一天
- Extjs4 日期+时间选择控件
- 更改SQLServer服务器时间
- linux 更改服务器时间
- 更改时间服务器
- ExtJs4日期datefield控件设置默认值
- ExtJs4日期datefield控件设置默认值
- 获取NTP时间服务器时间
- 用windows搭建ntp时间服务器(从上级获取时间,并为客户机提供时间)
- 获取服务器时间
- 获取服务器的时间
- JS 获取服务器时间
- php获取服务器时间
- 在ecplise中怎样忽略svn文件
- sql sa登陆失败 错误18456的解决方法
- List Set 集合概述
- [VC技术内幕V5翻译]第22章动态链接库(第一节)
- WEB前端优化:使用“渐进”图片或“交错”图片
- EXTJS4.0 datefield时间控件更改为获取服务器时间
- matlab 调试功能详解
- PeekMessage和GetMessage函数的主要区别
- USB 配置,接口,设置,endpoint描述符的关系
- 拓扑排序
- 软文营销:了解客户的需求及特点
- 数据库索引使用情况
- 吐槽一下win8
- C++虚函数表解析(转) ——写的真不错,忍不住转了