Results 1 to 4 of 4

Thread: ??????????????

  1. #1
    Ext JS Premium Member kuro's Avatar
    Join Date
    Mar 2009
    Posts
    34
    Vote Rating
    0
      0  

    Default ??????????????

    (1) ????
    Ext.form.DateField?????????????????????????????????

    ??????????????
    ??????????????????????Ext.DatePicker?????????????
    ???DatePicker????????????????????????21??
    ?DatePicker??????????????
    ????????????????????????????????????1?????63????
    ??????????DatePicker????????????

    (2) ????
    Ext.Date.format??????????????????????????????????
    ??????????????

  2. #2
    Sencha - Support Team yuki's Avatar
    Join Date
    Jun 2007
    Location
    Chigasaki, Japan
    Posts
    273
    Vote Rating
    0
      0  

    Default

    ???????????????????????????
    ?????????????????????????????????
    Code:
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <title>Ext.WarekiField????</title>
        <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.1.1/resources/css/ext-all.css" />
        <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/ext-all.js"> </script>
        <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/src/locale/ext-lang-ja.js"> </script>
    
        <script type="text/javascript"><!--
    
          // ext-lang-ja???
          Date.getShortMonthName = function(month) {
            return Date.monthNames[month];
          };
    
          // ???????????prefix_type = true???????????1?????
          Date.toJapaneseYearString = function(year, prefix_type){
            if(!year) return;
            year = parseInt(year);
    
            var wareki = [ 
              {start: 1868, short_name: 'M', long_name: '??'  },
              {start: 1912, short_name: 'T', long_name: '??'  },
              {start: 1926, short_name: 'S', long_name: '??'  },
              {start: 1989, short_name: 'H', long_name: '??'  }
            ];
    
            var prefix = prefix_type === true ? 'short_name' : 'long_name';
    
            if(year < wareki[0].start) return year;
            if(year < wareki[1].start) return wareki[0][prefix] + (year - wareki[0].start + 1); 
            if(year < wareki[2].start) return wareki[1][prefix] + (year - wareki[1].start + 1); 
            if(year < wareki[3].start) return wareki[2][prefix] + (year - wareki[2].start + 1);
            return wareki[3][prefix] + (year - wareki[3].start + 1);
          };
    
          /*
           * Ext.form.DateField??Ext.DatePicker???Ext.menu.DateMenu???????????
           * ??3?????????????????
           */
    
          // Ext.DatePicker?????Ext.WarekiPicker
          Ext.WarekiPicker = Ext.extend(Ext.DatePicker,{
    
            // ????????????
            updateMPYear : function(y){
                this.mpyear = y;
                var ys = this.mpYears.elements;
                for(var i = 1; i <= 10; i++){
                    var td = ys[i-1], y2;
                    if((i%2) === 0){
                        y2 = y + Math.round(i * 0.5);
                        td.firstChild.innerHTML = Date.toJapaneseYearString(y2, true); // ????
                        td.xyear = y2;
                    }else{
                        y2 = y - (5-Math.round(i * 0.5));
                        td.firstChild.innerHTML = Date.toJapaneseYearString(y2,true); // ????
                        td.xyear = y2;
                    }
                    this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');
                }
            },
    
            // ??????????????????????????????????????
            update : function(date, forceRefresh){
              Ext.WarekiPicker.superclass.update.apply(this,arguments);
    
              if(this.rendered){
                this.mbtn.setText(Date.toJapaneseYearString(date.getFullYear()) + '?' + this.monthNames[date.getMonth()]);
              }
            }
    
          });
    
          // Ext.menu.DateMenu?????Ext.WarekiMenu
          Ext.WarekiMenu = Ext.extend(Ext.menu.DateMenu, {
            initComponent: function(){
              Ext.WarekiMenu.superclass.initComponent.call(this);
    
              /*
               * Ext.menu.DateMenu.initComponent?????DatePicker??????????
               * ???????????superclass???????????????????
               * WarekiPicker?????????
               */
    
    
              // DatePicker????????????
              this.un('show', this.picker.focus, this.picker);
              this.picker.purgeListeners();
              this.remove(this.picker);
    
              // WarekiPicker?????????????
              this.picker = new Ext.WarekiPicker({
                internalRender: this.strict || !Ext.isIE,
                ctCls: 'x-menu-date-item',
                id: this.pickerId
              }, this.initialConfig);
              this.picker.purgeListeners();
    
              this.relayEvents(this.picker, ['select']);
              this.on('show', this.picker.focus, this.picker);
    
              this.add(this.picker);
            }
          });
    
          // Ext.form.DateField?????Ext.WarekiField?WarekiMenu???
          Ext.WarekiField = Ext.extend(Ext.form.DateField,{
            menu: new Ext.WarekiMenu({
              hideOnClick: false,
              focusOnSelect: false
            })
          });
    
          Ext.reg('warekifield', Ext.WarekiField);
    
          Ext.BLANK_IMAGE_URL = "http://extjs.cachefly.net/ext-3.1.1/resources/images/default/s.gif";
          Ext.onReady(function(){
            new Ext.WarekiField({
              renderTo: Ext.getBody(),
              width: 200
            });
          });
        // --></script>
      </head>
      <body>
        <h1>Ext.WarekiField????</h1>
      </body>
    </html>
    Ext Japan, LLC [Twitter: @extjapan]
    [Ext JS / Ext GWT????????][????????????][Ext JS???????????????]

  3. #3
    Ext JS Premium Member kuro's Avatar
    Join Date
    Mar 2009
    Posts
    34
    Vote Rating
    0
      0  

    Default ??????????

    yuki????????????
    ?????????????

  4. #4
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    44
    Vote Rating
    4
      0  

    Default

    Mr Yuki,

    Please provide me example of the same date picker compatible for extjs version 4.1.x

    thanks in advance...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •