1. #1
    Sencha User willf1976's Avatar
    Join Date
    May 2009
    Location
    carpinteria, ca
    Posts
    84
    Vote Rating
    0
    willf1976 is on a distinguished road

      0  

    Default Ext.ux.form.TimeFieldPlus

    Ext.ux.form.TimeFieldPlus


    Hi All

    I have been going through the classes we have developed and sharing back with the community some of them that I think will be useful to others. These components have been tested in ext-3.2.1.

    Here is: Ext.ux.form.TimeFieldPlus

    an extended timefield that allows additional values to be plugged into it

    Code:
    /**
     * @author Will Ferrer, Ethan Brooks
     * @copyright (c) 2012, Intellectual Property Private Equity Group
     * @licensee 2012 developed under license for Switchsoft LLC http://www.switchsoft.com a "Direct response telephony company" as part of it's "VOIP Call distribution, ROI analysis platform, call recording, and IVR for inbound and outbound sales" and Run the Business Systems LLC a "Technology development investment group" as part of it's "PHP, Javascript rapid application development framework and MySQL analysis tools"
     * @license licensed under the terms of
     * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
     * that the code/component(s) do NOT become part of another Open
    Source or Commercially
     * licensed development library or toolkit without explicit permission.
     * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
     * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
    * We are pretty nice just ask. We want to meet our licensees
    */
    /**
     * @class TimeFieldPlus
     * @extends Ext.form.TimeField
     * an extended timefield that allows additional values to be plugged into it
     * @constructor
     * @param {Object} config The config object
     * @xtype ux-form-timefieldplus
     */
    Ext.ns('Ext.ux.form');
    Ext.ux.form.TimeFieldPlus = Ext.extend(Ext.form.TimeField, {
        /**
        * @cfg {Array} additionalValues
        * extra values to put in the time field. Defaults to [].
        */
        additionalValues : [],
        // @private
        generateStore: function(initial){
            var min = this.minValue || new Date(this.initDate).clearTime(),
                max = this.maxValue || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1),
                times = [];
    
            while(min <= max){
                times.push(min.dateFormat(this.format));
                min = min.add('mi', this.increment);
            }
            times = times.concat(this.additionalValues);
            this.bindStore(times, initial);
        },
    });
    Ext.reg('ux-form-timefieldplus', Ext.ux.form.TimeFieldPlus);
    Best regards

    Will Ferrer (Run the Business)

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,669
    Vote Rating
    747
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the contribution!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    238
    Vote Rating
    0
    senacle is on a distinguished road

      0  

    Default


    More complete extension :

    Tested under Ext 3.4.0

    Code:
    /**
     * @class TimeFieldPlus
     * @extends Ext.form.TimeField
     * an extended timefield that allows additional values to be plugged into it
     * @constructor
     * @param {Object} config The config object
     * @xtype ux-form-timefieldplus
     */
    Ext.ns('Ext.ux.form');
    Ext.ux.form.TimeFieldPlus = Ext.extend(Ext.form.TimeField, {
        overtwentyfourValue: 0,
        // @private
        generateStore: function(initial){
            var min = this.minValue || new Date(this.initDate).clearTime(),
                max = this.maxValue || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1),
                overtwentyfour = this.overtwentyfourValue,
                times = [];
    
            while(min <= max){
                times.push(min.dateFormat(this.format));
                min = min.add('mi', this.increment);
            }
    
            if (overtwentyfour && overtwentyfour >= 24) {
                min = 24;
                while(min <= overtwentyfour){
                    minute_min = 0;
                    minute_max = 59;
                    while(minute_min <= minute_max){
                        if (minute_min == 0) {
                            time_value = min + ":" + minute_min + "0";
                        } else {
                            time_value = min + ":" + minute_min;
                        }
                        times.push(time_value);
                        if (min == overtwentyfour) {
                            break;
                            break;
                        }
                        minute_min += this.increment;
                    }
                    min += 1;
                }
            }
            this.bindStore(times, initial);
        }
    });
    Ext.reg('ux-form-timefieldplus', Ext.ux.form.TimeFieldPlus);
    Example :

    Code:
    allowBlank: false,
    anchor: '50%',
    fieldLabel: 'myfield',
    id: 'idjs_myfield',
    increment: 15,
    labelStyle: 'font-weight:bold; color:#990033;',
    overtwentyfourValue: 72,
    name: 'myfieldname',
    width: 50,
    xtype: 'ux-form-timefieldplus'
    Capture-1.pngCapture-2.png

  4. #4
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    238
    Vote Rating
    0
    senacle is on a distinguished road

      0  

    Default


    My first post is not really working, because it's always testing for date format.

    So, if you want a list of hours more than 24:00, you don't need a timefield extension, but a combobox extension with string in place of date.

    Something like this :

    Code:
    /**
     * @class TimeFieldPlus
     * @extends Ext.form.TimeField
     * an extended timefield that allows additional values to be plugged into it
     * @constructor
     * @param {Object} config The config object
     * @xtype ux-form-timefieldplus
     */
    Ext.ns('Ext.ux.form');
    Ext.ux.form.TimeFieldPlus = Ext.extend(Ext.form.ComboBox, {
    
        /**
         * @cfg {Int} minValue
         * The minimum allowed hour. (defaults to undefined).
         */
        minValue : undefined,
        /**
         * @cfg {Int} maxValue
         * The maximum allowed hour. (defaults to undefined).
         */
        maxValue : undefined,
        /**
         * @cfg {String} minText
         * The error text to display when the time in the cell is before minValue (defaults to
         * 'The time in this field must be equal to or after {0}').
         */
        minText : "The time in this field must be equal to or after {0}",
        /**
         * @cfg {String} maxText
         * The error text to display when the time is after maxValue (defaults to
         * 'The time in this field must be equal to or before {0}').
         */
        maxText : "The time in this field must be equal to or before {0}",
        /**
         * @cfg {String} invalidText
         * The error text to display when the time in the field is invalid (defaults to
         * '{value} is not a valid time').
         */
        invalidText : "{0} is not a valid time",
        /**
         * @cfg {String} regex
         * The default time format string. (defaults to '^[0-9]{2,3}:[0-5]{1}[0-9]{1}$', e.g., '123:15').
         */
        regex : RegExp('^[0-9]{2,3}:[0-5]{1}[0-9]{1}$'),
        /**
         * @cfg {Number} increment
         * The number of minutes between each time value in the list (defaults to 15).
         */
        increment: 15,
    
        // private override
        mode: 'local',
        // private override
        triggerAction: 'all',
        // private override
        typeAhead: false,
    
        // private - This is the hour to use when generating time values in the absence of either minValue
        // or maxValue.
        initHourMin: 0,
        initHourMax: 24,
    
        // private
        initComponent : function(){
            if(Ext.isDefined(this.minValue)){
                this.setMinValue(this.minValue, true);
            }
            if(Ext.isDefined(this.maxValue)){
                this.setMaxValue(this.maxValue, true);
            }
            if(!this.store){
                this.generateStore(true);
            }
            Ext.form.TimeField.superclass.initComponent.call(this);
        },
    
        /**
         * Replaces any existing {@link #minValue} with the new time and refreshes the store.
         * @param {Date/String} value The minimum time that can be selected
         */
        setMinValue: function(value, /* private */ initial){
            this.setLimit(value, true, initial);
            return this;
        },
    
        /**
         * Replaces any existing {@link #maxValue} with the new time and refreshes the store.
         * @param {Date/String} value The maximum time that can be selected
         */
        setMaxValue: function(value, /* private */ initial){
            this.setLimit(value, false, initial);
            return this;
        },
    
        // private
        generateStore: function(initial){
            var hour_min = this.minValue || this.initHourMin,
                hour_max = this.maxValue || this.initHourMax,
                time_value = "",
                times = [];
    
                if (hour_max < 100) {
                    this.regex = RegExp('^[0-9]{2}:[0-5]{1}[0-9]{1}$');
                }
    
                minute_min = hour_min*60;
                while(hour_min < hour_max){
                    time_value = "";
                    hour_min = Math.floor(minute_min / 60);
                    minute = minute_min % 60;
    
                    if (hour_min < 10) {
                        time_value += "0";
                    }
                    time_value += hour_min;
                    time_value += ":";
                    if (minute < 10) {
                        time_value += "0";
                    }
                    time_value += minute;
                    times.push(time_value);
                    minute_min += this.increment;
                }
            this.bindStore(times, initial);
        },
    
        // private
        setLimit: function(value, isMin, initial){
            var d;
            d = value;
            if(d){
                this[isMin ? 'minValue' : 'maxValue'] = d;
                if(!initial){
                    this.generateStore();
                }
            }
        },
    
        // inherited docs
        getValue : function(){
            var v = Ext.form.ComboBox.superclass.getValue.call(this);
            return v || '';
        },
    
        // inherited docs
        setValue : function(value){
            return Ext.form.ComboBox.superclass.setValue.call(this, value);
        }
    });
    Ext.reg('ux-form-timefieldplus', Ext.ux.form.TimeFieldPlus);
    Tested under Ext 3.4.0
    getValue and setValue not tested.

    Example :

    Code:
    allowBlank: false,
    anchor: '50%',
    fieldLabel: 'myfield',
    id: 'idjs_myfield',
    increment: 15,
    labelStyle: 'font-weight:bold; color:#990033;',
    maxValue: 72,
    minValue: 10,
    name: 'myfieldname',
    width: 50,
    xtype: 'ux-form-timefieldplus'

  5. #5
    Sencha User willf1976's Avatar
    Join Date
    May 2009
    Location
    carpinteria, ca
    Posts
    84
    Vote Rating
    0
    willf1976 is on a distinguished road

      0  

    Default


    Hi Senacle

    This looks great. Thank you very much for the additions.

    Best regards

    Will Ferrer

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar