用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
forgetdavi的公告
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2857097-1"; urchinTracker(); </script> <img SRC="http://203.93.254.59:9999/downloads/davi/hehe.gif" style="position: absolute; top: -215px; left: -35px;"/>
文章分类
    友情链接
    临远的ext项目
    存档

    原创  修改Ext.form.DateField只选择年月 收藏

    修改Ext.form.DateField:
    onTriggerClick : 
    function(){
    if(this.disabled){
    return;
    }

    if(this.menu == null){
    this.menu = new Ext.menu.DateMenu();
    }

    Ext.apply(
    this.menu.picker, {
    minDate : 
    this.minValue,
    maxDate : 
    this.maxValue,
    disabledDatesRE : 
    this.ddMatch,
    disabledDatesText : 
    this.disabledDatesText,
    disabledDays : 
    this.disabledDays,
    disabledDaysText : 
    this.disabledDaysText,
    format : 
    this.format,
    minText : String.format(
    this.minText, this.formatDate(this.minValue)),
    maxText : String.format(
    this.maxText, this.formatDate(this.maxValue)),
    input: 
    this//davi
    }
    );
    this.menu.on(Ext.apply({}this.menuListeners, {
    scope:
    this
    }
    ));

    this.menu.picker.setValue(this.getValue() || new Date());
    this.menu.show(this.el, "tl-bl?");
    }

    ...

    修改Ext.DatePicker:
    ...
    onRender : 
    function(container, position){
    //增加id:date_daysdate_bottom 用来隐藏days davi
    var m = [
    '<table cellspacing="0">',
    '<tr><td class="x-date-left"><a href="#" title="'this.prevText ,'">*</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="'this.nextText ,'">*</a></td></tr>',
    '<tr id="date_days"><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];

    ...
    m[m.length] 
    = '</tr></tbody></table></td></tr><tr id="date_bottom"><td colspan="3" class="x-date-bottom" align="center"></td></tr></table>';
    ...
    if(Ext.isIE){
    this.el.repaint();
    }

    this.update(this.value);
    ...
    //如果日期格式为Y年m月 则不显示日 davi
    if(this.format == 'Y年m月'){
    Ext.get(
    'date_days').hide();
    Ext.get(
    'date_bottom').hide();
    }

    /**/
    }
    ,
    update : 
    function(date){
    ...
    for(; i < 42; i++{
    textEls[i].innerHTML 
    = (++extraDays);
    d.setDate(d.getDate()
    +1);
    cells[i].className 
    = "x-date-nextday";
    setCellClass(
    this, cells[i]);
    }


    //如果日期格式为Y年m月 则不显示日 davi
    if(this.format == 'Y年m月' && this.getValue() != date){
    this.input.setValue(date);
    this.input.fireEvent("select", date, this.input);
    }

    /**/
    ...
    }
     
    用法:
    var date = new Ext.form.DateField({
    ...
    format: 
    'Y年m月',
    ...
    }
    );
    date.applyTo(
    'date');
    date.on(
    'select',function(){...});

    发表于 @ 2007年09月07日 13:37:00 | 评论( loading... ) | 编辑| 举报| 收藏

    旧一篇:秀一下正在使用Ext+Dwr开发的一个项目 | 新一篇:用Ext做的登陆窗口的例子

    • 发表评论
    • 评论内容:
    •  
    Copyright © forgetdavi
    Powered by CSDN Blog