1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    38
    Vote Rating
    3
    panbayi is on a distinguished road

      0  

    Default Sencha Cmd throw error : failed parsing

    Sencha Cmd throw error : failed parsing


    When I try to build production using Sencha Cmd v3.0.2.288,it throws error as following :
    [ERR] com.sencha.exceptions.BasicException: The following error occurr
    ed while executing this line:
    D:\Program Files\Apache2.2\htdocs\web_ser\.sencha\app\build-impl.xml:368: com.se
    ncha.exceptions.ExParse: Failed parsing D:\Program Files\Apache2.2\htdocs\web_se
    r\app\ux\DateTimePicker.js

    DateTimePicker.js :
    PHP Code:
    Ext.define('Ext.ux.DateTimePicker', {    extend'Ext.picker.Date',    alias'widget.datetimepicker',    renderTpl: [        '<div id="{id}-innerEl" role="grid">',            '<div role="presentation" class="{baseCls}-header">',                '<div class="{baseCls}-prev"><a id="{id}-prevEl" href="#" role="button" title="{prevText}"></a></div>',                '<div class="{baseCls}-month" id="{id}-middleBtnEl">{%this.renderMonthBtn(values, out)%}</div>',                '<div class="{baseCls}-next"><a id="{id}-nextEl" href="#" role="button" title="{nextText}"></a></div>',            '</div>',            '<table id="{id}-eventEl" class="{baseCls}-inner" cellspacing="0" role="presentation">',                '<thead role="presentation"><tr role="presentation">',                    '<tpl for="dayNames">',                        '<th role="columnheader" title="{.}"><span>{.:this.firstInitial}</span></th>',                    '</tpl>',                '</tr></thead>',                '<tbody role="presentation"><tr role="presentation">',                    '<tpl for="days">',                        '{#:this.isEndOfWeek}',                        '<td role="gridcell" id="{[Ext.id()]}">',                            '<a role="presentation" href="#" hidefocus="on" class="{parent.baseCls}-date" tabIndex="1">',                                '<em role="presentation"><span role="presentation"></span></em>',                            '</a>',                        '</td>',                    '</tpl>',                '</tr></tbody>',            '</table>',            '<tpl if="showToday">',                '<div id="{id}-footerEl" role="presentation"   class="{baseCls}-footer">{%this.renderHour(values, out)%}{%this.renderMinute(values, out)%}{%this.renderSecond(values, out)%}{%this.renderTodayBtn(values, out)%}</div>',            '</tpl>',        '</div>',        {            firstInitial: function(value) {                return Ext.picker.Date.prototype.getDayInitial(value);            },            isEndOfWeek: function(value) {                // convert from 1 based index to 0 based                // by decrementing value once.                value--;                var end = value % 7 === 0 && value !== 0;                return end ? '</tr><tr role="row">' : '';            },            longDay: function(value){                return Ext.Date.format(value, this.longDayFormat);            },            renderHour: function(values, out) {                Ext.DomHelper.generateMarkup(values.$comp.hour.getRenderTree(), out);            },            renderMinute: function(values, out) {                out.push('<font  style="float : left;font-weight:bold;">&nbsp&nbsp:&nbsp&nbsp</font>');                Ext.DomHelper.generateMarkup(values.$comp.minute.getRenderTree(), out);            },            renderSecond: function(values, out) {                out.push('<font style="float : left;font-weight:bold;">&nbsp&nbsp:&nbsp&nbsp</font>');                Ext.DomHelper.generateMarkup(values.$comp.second.getRenderTree(), out);            },            renderTodayBtn: function(values, out) {                Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);            },            renderMonthBtn: function(values, out) {                Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);            }        }    ],    /*     * 创建时分秒控件     */    beforeRender: function () {        /*---------------------*/        var me = this;        me.hour = Ext.create('Ext.form.field.Number', {            scope: me,            ownerCt: me,            editable : false,            ownerLayout: me.getComponentLayout(),               minValue: 0,               maxValue: 23,               width: 45,               style : {float:"left"},               enableKeyEvents: true,               listeners: {                 keyup: function(field, e){                     if (field.getValue() > 23){                         e.stopEvent();                         field.setValue(23);                     }                 }             }        });                me.minute = Ext.create('Ext.form.field.Number', {            scope: me,            ownerCt: me,               style : {float:"left"},            ownerLayout: me.getComponentLayout(),            minValue: 0,            maxValue: 59,            editable : false,            width: 45,            enableKeyEvents: true,            listeners: {                keyup: function(field, e){                    if (field.getValue() > 59){                        e.stopEvent();                        field.setValue(59);                    }                }            }        });              me.second = Ext.create('Ext.form.field.Number', {            scope: me,            ownerCt: me,            editable : false,               style : {float:"left"},            ownerLayout: me.getComponentLayout(),            minValue: 0,            maxValue: 59,            width: 45,            enableKeyEvents: true,            listeners: {                keyup: function(field, e){                    if (field.getValue() > 59){                        e.stopEvent();                        field.setValue(59);                    }                }            }        });                me.callParent();    },
        /*     * 渲染时分秒控件     */    
    finishRenderChildren: function () {        this.callParent();        /*--------------------------------------*/        this.hour.finishRender();        this.minute.finishRender();        this.second.finishRender();        /*--------------------------------------*/    },    /*     * Update the contents of the picker     * @private     * @param {Date} date The new date     * @param {Boolean} forceRefresh True to force a full refresh     */    update : function(dateforceRefresh){        var me this;        /*-----------设置时分秒----------------*/        date.setHours(me.hour.getValue());        date.setMinutes(me.minute.getValue());        date.setSeconds(me.second.getValue());        /*-----------设置时分秒----------------*/                me.callParent(arguments);    }}); 
    What should I do ?

  2. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    38
    Vote Rating
    3
    panbayi is on a distinguished road

      0  

    Default


    Make it easier for reading
    Code:
    Ext.define('Ext.ux.DateTimePicker', {
        extend: 'Ext.picker.Date',
        alias: 'widget.datetimepicker',
        renderTpl: [
            '<div id="{id}-innerEl" role="grid">',
                '<div role="presentation" class="{baseCls}-header">',
                    '<div class="{baseCls}-prev"><a id="{id}-prevEl" href="#" role="button" title="{prevText}"></a></div>',
                    '<div class="{baseCls}-month" id="{id}-middleBtnEl">{%this.renderMonthBtn(values, out)%}</div>',
                    '<div class="{baseCls}-next"><a id="{id}-nextEl" href="#" role="button" title="{nextText}"></a></div>',
                '</div>',
                '<table id="{id}-eventEl" class="{baseCls}-inner" cellspacing="0" role="presentation">',
                    '<thead role="presentation"><tr role="presentation">',
                        '<tpl for="dayNames">',
                            '<th role="columnheader" title="{.}"><span>{.:this.firstInitial}</span></th>',
                        '</tpl>',
                    '</tr></thead>',
                    '<tbody role="presentation"><tr role="presentation">',
                        '<tpl for="days">',
                            '{#:this.isEndOfWeek}',
                            '<td role="gridcell" id="{[Ext.id()]}">',
                                '<a role="presentation" href="#" hidefocus="on" class="{parent.baseCls}-date" tabIndex="1">',
                                    '<em role="presentation"><span role="presentation"></span></em>',
                                '</a>',
                            '</td>',
                        '</tpl>',
                    '</tr></tbody>',
                '</table>',
                '<tpl if="showToday">',
                    '<div id="{id}-footerEl" role="presentation"   class="{baseCls}-footer">{%this.renderHour(values, out)%}{%this.renderMinute(values, out)%}{%this.renderSecond(values, out)%}{%this.renderTodayBtn(values, out)%}</div>',
                '</tpl>',
            '</div>',
            {
                firstInitial: function(value) {
                    return Ext.picker.Date.prototype.getDayInitial(value);
                },
                isEndOfWeek: function(value) {
                    // convert from 1 based index to 0 based
                    // by decrementing value once.
                    value--;
                    var end = value % 7 === 0 && value !== 0;
                    return end ? '</tr><tr role="row">' : '';
                },
                longDay: function(value){
                    return Ext.Date.format(value, this.longDayFormat);
                },
                renderHour: function(values, out) {
                    Ext.DomHelper.generateMarkup(values.$comp.hour.getRenderTree(), out);
                },
                renderMinute: function(values, out) {
                    out.push('<font  style="float : left;font-weight:bold;">&nbsp&nbsp:&nbsp&nbsp</font>');
                    Ext.DomHelper.generateMarkup(values.$comp.minute.getRenderTree(), out);
                },
                renderSecond: function(values, out) {
                    out.push('<font style="float : left;font-weight:bold;">&nbsp&nbsp:&nbsp&nbsp</font>');
                    Ext.DomHelper.generateMarkup(values.$comp.second.getRenderTree(), out);
                },
                renderTodayBtn: function(values, out) {
                    Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
                },
                renderMonthBtn: function(values, out) {
                    Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
                }
            }
        ],
        /*
         * 创建时分秒控件
         */
        beforeRender: function () {
            /*---------------------*/
            var me = this;
            me.hour = Ext.create('Ext.form.field.Number', {
                scope: me,
                ownerCt: me,
                editable : false,
                ownerLayout: me.getComponentLayout(),
                   minValue: 0,
                   maxValue: 23,
                   width: 45,
                   style : {float:"left"},
                   enableKeyEvents: true,
                   listeners: {
                     keyup: function(field, e){
                         if (field.getValue() > 23){
                             e.stopEvent();
                             field.setValue(23);
                         }
                     }
                 }
            });
            
            me.minute = Ext.create('Ext.form.field.Number', {
                scope: me,
                ownerCt: me,
                   style : {float:"left"},
                ownerLayout: me.getComponentLayout(),
                minValue: 0,
                maxValue: 59,
                editable : false,
                width: 45,
                enableKeyEvents: true,
                listeners: {
                    keyup: function(field, e){
                        if (field.getValue() > 59){
                            e.stopEvent();
                            field.setValue(59);
                        }
                    }
                }
            });
            
          me.second = Ext.create('Ext.form.field.Number', {
                scope: me,
                ownerCt: me,
                editable : false,
                   style : {float:"left"},
                ownerLayout: me.getComponentLayout(),
                minValue: 0,
                maxValue: 59,
                width: 45,
                enableKeyEvents: true,
                listeners: {
                    keyup: function(field, e){
                        if (field.getValue() > 59){
                            e.stopEvent();
                            field.setValue(59);
                        }
                    }
                }
            });
            
            me.callParent();
        },
    
    
        /*
         * 渲染时分秒控件
         */
        finishRenderChildren: function () {
            this.callParent();
            /*--------------------------------------*/
            this.hour.finishRender();
            this.minute.finishRender();
            this.second.finishRender();
            /*--------------------------------------*/
        },
        /*
         * Update the contents of the picker
         * @private
         * @param {Date} date The new date
         * @param {Boolean} forceRefresh True to force a full refresh
         */
        update : function(date, forceRefresh){
            var me = this;
            /*-----------设置时分秒----------------*/
            date.setHours(me.hour.getValue());
            date.setMinutes(me.minute.getValue());
            date.setSeconds(me.second.getValue());
            /*-----------设置时分秒----------------*/
            
            me.callParent(arguments);
        }
    });