当前位置: 代码迷 >> Web前端 >> ext combox 设立默认选项
  详细解决方案

ext combox 设立默认选项

热度:649   发布时间:2012-08-31 12:55:03.0
ext combox 设置默认选项

/**

?* author:cai.zhenyao

?* operator: 操作类型,用于Action的一些逻辑判断

?* isFirst: 表示是否为第一次打开窗口,修改时要设置默认选项

?* selectRecord:修改时所选中的记录

?*/

Ext.onReady(function(){

var dayStore = new Ext.data.SimpleStore({ ?

?? ? ? ?fields:['days','post1'], ?

?? ? ? ?data:[['01','01'],['02','02'],['03','03'],['04','04']] ?

?? ? ?})

new Ext.Viewport({

? ?layout: 'border',

? ?items: [{

? ? fieldLabel:'月结账日', ?

?? ? ? ? ? ?xtype:'combo', ?

?? ? ? ? ? ?id:'thisDay', ?

?? ? ? ? ? ?hiddenName:'Qdeptid', ?

?? ? ? ? ? ?store:dayStore, ?

?? ? ? ? ? ?displayField:'days', ?

?? ? ? ? ? ?valueField:'post1', ?

?? ? ? ? ? ?forceSelection:true, ?

?? ? ? ? ? ?selectOnFocus:true, ?

?? ? ? ? ? ?editable:false, ?

?? ? ? ? ? ?triggerAction:'all', ?

?? ? ? ? ? ?mode:'local', ?

?? ? ? ? ? ?value:new Date().format("Y-m-d").substring(8,10)+"日"?

? ?}]

});

dayStore.findBy(function(record) { //返回选中数据的索引。

? if(record.get("days")=="01"){

? return true;

? }

});?

})