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

熱點內容
捕魚達人歷史版本 瀏覽:73
mp4視頻文件解密軟體 瀏覽:62
多軸編程哪個軟體最方便 瀏覽:27
老平板哪個是顯示屏數據線插座 瀏覽:849
5sing上傳音頻文件格式 瀏覽:171
win10輸入文件滑鼠右鍵異常 瀏覽:634
聽幼兒故事用什麼app 瀏覽:514
iphone修改音頻文件名 瀏覽:53
國家氣象站點數據在哪裡下載 瀏覽:342
網路設置的網站 瀏覽:914
手機測量放樣怎麼導數據和線型 瀏覽:648
企業展示型網站源碼 瀏覽:781
易花花app哪裡下載 瀏覽:323
外國程序員職業生涯長 瀏覽:709
看理想app怎麼注銷賬號 瀏覽:545
數控銑床加工手工編程的步驟有哪些 瀏覽:411
uc瀏覽器為什麼很多網站進不了 瀏覽:513
西部數據移動硬碟怎麼 瀏覽:645
批處理修改子目錄文件名命令 瀏覽:405
文件損壞怎麼刪除 瀏覽:977

友情鏈接