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

熱點內容
ps做成圖片後怎麼弄成文件 瀏覽:689
左側導航欄css代碼 瀏覽:952
釘釘傳送文件最大多少兆 瀏覽:126
app下載哪裡最全 瀏覽:599
word如何畫大箭頭 瀏覽:245
word批量轉pdf工具21注冊機 瀏覽:546
列印文檔文件3000字需要多少錢 瀏覽:239
泊車助手app 瀏覽:147
pscs6完全自學教程 瀏覽:461
文件夾去不掉只讀屬性 瀏覽:203
qq怎麼接收文件夾 瀏覽:35
javahashmapvalues 瀏覽:548
滑鼠選定不了文件內容是壞了么 瀏覽:589
打開excel標准模板文件名 瀏覽:798
該文件名字不包含擴展名 瀏覽:565
華為備份文件 瀏覽:368
批量刪除cpp文件代碼注釋的工具 瀏覽:312
下列哪些不屬於可編程邏輯器件 瀏覽:963
蘋果6p跳屏是什麼原因 瀏覽:383
下載文件路徑是什麼 瀏覽:852

友情鏈接