導航:首頁 > 編程語言 > 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日期驗證相關的資料

熱點內容
maya粒子表達式教程 瀏覽:84
抖音小視頻如何掛app 瀏覽:283
cad怎麼設置替補文件 瀏覽:790
win10啟動文件是空的 瀏覽:397
jk網站有哪些 瀏覽:134
學編程和3d哪個更好 瀏覽:932
win10移動硬碟文件無法打開 瀏覽:385
文件名是亂碼還刪不掉 瀏覽:643
蘋果鍵盤怎麼打開任務管理器 瀏覽:437
手機桌面文件名字大全 瀏覽:334
tplink默認無線密碼是多少 瀏覽:33
ipaddgm文件 瀏覽:99
lua語言編程用哪個平台 瀏覽:272
政采雲如何導出pdf投標文件 瀏覽:529
php獲取postjson數據 瀏覽:551
javatimetask 瀏覽:16
編程的話要什麼證件 瀏覽:94
錢脈通微信多開 瀏覽:878
中學生學編程哪個培訓機構好 瀏覽:852
榮耀路由TV設置文件共享錯誤 瀏覽:525

友情鏈接