導航:首頁 > 編程語言 > extjs日期驗證

extjs日期驗證

發布時間:2024-10-24 15:58:38

1. extjs 判斷是不是日期類型

日期判斷

function getDiffDate(m){
m-=(D=parseInt(m/86400000))*86400000;
return D+"";
}
//判斷日期大小
Ext.apply(Ext.form.VTypes,{
validate:function(componentValue,h){//componentValue就是觸發這個事件的組件的值
if(h.param.id){
var graateTime= new Date(componentValue).getTime();
var enterTime = new Date(Ext.getCmp(h.param.id).getValue()).getTime();
if(getDiffDate(graateTime-enterTime)<0){
return false;
}
return true;
}
},
validateText:'入學時間必須晚於畢業時間'
});
var enterDate = new Ext.form.DateField({
fieldLabel:'入學時間',
format:'Y/m/d',
allowBlank:false,
selectOnFocus:true,
name:'enterDate',
id:"enterTime",
width:200
});

var graateDate = new Ext.form.DateField({
fieldLabel:'畢業時間',
format:'Y/m/d',
name:'graateDate',
id:"graateTime",
width:200,
vtype:'validate',
param:{id:'enterTime'}//入學時間的id
});

2. extjs表格日期類型顯示為[object Object]

傳到前台的json,日期最好是字元串的,在後台查詢時,就把日期格式化好,這樣前台處理非常容易。

然後如果非要前台處理,Ext.data.Record.create這個最好指明類型,
如:var sample = new Ext.data.Record.create([{
name : "id",
type : "string",
mapping : "id"
}, {
name : "name",
type : "string",
mapping : "name"
}
.....

{header : '開始時間', dataIndex : 'createDate',
renderer:function(value){
if(value instanceof Date){
return new Date(value).format("Y-m-d");
}else{
return value;
}
}
這個的寫法沒問題

3. Extjs grid表中修改日期(datafield),後台獲取的卻是Wed Sep 10 2014 00:00:00 GMT+0800這樣的格式

因為你Model中 djrq 可能設置的 type = 'date' , 所以會轉換為 date並且提交的時候又從date專程了string...所以到後台就是那種格式了

4. extJs中的datefield怎麼設置 能只選擇當前時間以後的日期

這個設置一個監聽函數,選擇之後如果是當前日期之前的日期則給出提示,而且dateField不賦值。可以使用 onSelect事件

5. Extjs 中DateFiled的日期格式問題

{
header:'時間',
dataIndex:'date',
editor:newExt.grid.GridEditor(newExt.form.DateField({
format:'Y-m-d'
})),
renderer:function(value){
returnvalue.format("Y-m-d");
}
}

6. extjs的datefield輸入錯誤值時不讓自動修改日期格式

開啟field的值有效驗證,提交前判斷存在無效field時不允許繼續。

閱讀全文

與extjs日期驗證相關的資料

熱點內容
車架號密碼計算器 瀏覽:588
易語言linux數據包模塊 瀏覽:939
安裝手機豆瓣都會出現哪些文件夾 瀏覽:228
怎麼搜索文件內的內容 瀏覽:715
怎麼才能慢走絲編程 瀏覽:956
電腦有網路手機連不上wifi萬能鑰匙 瀏覽:623
完美世界高級易容卷文件 瀏覽:466
如何安裝國家反詐中心app安裝 瀏覽:343
刪除軟體配置文件 瀏覽:98
空管需要什麼編程能力 瀏覽:273
window10如何開啟app相機 瀏覽:798
網易有道詞典app為什麼不簡潔 瀏覽:813
非結構化數據都存放在哪裡 瀏覽:355
安卓關閉飛行模式震動事件監聽 瀏覽:436
如何追蹤文件傳播路徑 瀏覽:689
c語言讀大文件 瀏覽:419
os版本太舊無法刪除 瀏覽:536
列印文件怎麼把字變大 瀏覽:921
linuxcast 瀏覽:979
全職殺手兩個版本 瀏覽:988

友情鏈接