1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    70
    Vote Rating
    0
    koolll is on a distinguished road

      0  

    Default Unanswered: Not able to load keypad plugins

    Unanswered: Not able to load keypad plugins


    Hi,I need to load extension to my apps. but the extensionseen like does nt able to work well.
    I think i need to convert the extension to sencha touch 2,x

    Here is the extension that i need to use in my app
    http://msmeeks.github.com/sencha-keypad/examples.html

    Here is my keypad.js
    Code:
    //--Visual num keypad --
    
    Ext.define('Utility.Keypad', {
        extend: 'Ext.Container',
        xtype: 'keypad',
    
    
        requires: [
            'Ext.form.Panel',
            'Ext.form.FieldSet',
            'Ext.field.Text'
    
    
        ],
    
    
    
    
        config: {
            ui: null,
            centered :true;
        },
    
    
        constructor: function (config) {
            Ext.apply(this, config);
            Utility.Keypad.superclass.constructor.apply(this, arguments);
        },
    
    
        initialize: function (config) {
    
    
            config = config || {};
            var width = 500;
            var height = 650;
            var button_ui = 'action';
            var key_style = 'font-size:27pt;margin:5px;';
            if (this.getUi() == 'small') {
                width = 300;
                height = 350;
                button_ui = 'confirm-small';
                key_style = 'font-size:20pt;margin:5px;';
            }
    
    
    
    
            this.keypad_display = new Ext.form.Text({
                id: 'keypad_value',
                disabled: true,
                value: ''
            });
    
    
    
    
            this.createDigitKey = function (digit) {
                return {
                    xtype: 'button',
                    text: digit,
                    handler: function () {
                        this.addDigit(digit);
                    }, scope: this
                }
            };
    
    
            this.submit_button = new Ext.Button({
                text: config.submitText || 'Submit',
                ui: button_ui,
                handler: function (b, e) {
                    if (config.submitUrl) {
                        var params = {};
                        params[config.submitParamName || 'value'] = this.getValue();
    
    
                        Ext.Ajax.request({
                            url: config.submitUrl,
                            params: params,
                            success: function (response, opts) {
                                var data = Ext.util.JSON.decode(response.responseText);
                                if (data.success && data.redirect_url) {
                                    window.location.href = data.redirect_url;
                                } else {
                                    alert(data.msg);
                                }
                            },
                            failure: function (response, opts) {
                                var data = Ext.util.JSON.decode(response.responseText);
                                var message = data.msg || 'There was an error submitting the input.';
    
    
                                Ext.ux.MessageBox.alert('Error', message);
                            },
                            scope: this
                        });
                    } else if (config.submitHandler) {
                        config.submitHandler(this.getValue(), this, b, e);
                    } else {
                        Ext.Msg.alert('No submission action specified', 'value: ' + this.getValue());
                    }
                },
                scope: this
            });
    
    
            this.title_bar = {};
            if (config.title) {
                this.title_bar = {
                    dock: 'top',
                    xtype: 'toolbar',
                    title: config.title
                };
            }
    
    
            this.keypad_panel = new Ext.Panel({
                title: 'Panel',
                id: 'keypad_panel',
                width: width,
                height: height,
                layout: {
                    type: 'vbox',
                    pack: 'center',
                    align: 'stretch'
                },
                defaults: {
                    layout: 'hbox',
                    align: 'stretch',
                    flex: 1,
                    defaults: {
                        style: key_style,
                        flex: 1
                    }
                },
                dockedItems: [this.title_bar],
                items: [{
                    items: [this.keypad_display]
                }, {'), 
                    items: [this.createDigitKey('1this.createDigitKey('2'), this.createDigitKey('3')]
                }, {
                    items: [this.createDigitKey('4'), this.createDigitKey('5'), this.createDigitKey('6')]
                }, {
                    items: [this.createDigitKey('7'), this.createDigitKey('8'), this.createDigitKey('9')]
                }, {
                    items: [{},
                        this.createDigitKey('0'), {
                            xtype: 'button',
                            icon: 'btnbs.png', /// <reference path="../btnbs.png" />
                            handler: function () {
                                this.backSpace()
                            }, scope: this
                        }, ]
                }, {
                    items: [{
                        xtype: 'button',
                        ui: button_ui,
                        text: config.clearText || 'Clear',
                        handler: function () {
                            this.clear()
                        }, scope: this
                    },
                            this.submit_button
                        ]
                }]
            });
    
    
    
    
            if (config.centered) {
                config.layout = { type: 'hbox', pack: 'center' };
    
    
            }
            alert(config.centered);
            config.height = height;
            this.add(this.keypad_panel);
            this.on('afterrender', function () { this.doLayout(); }, this);
            Ext.apply(this, config);
    
    
        }
    
    
    
    
    
    
    })

    My js file which decide to include keypad plugin
    Code:
    Ext.define('bluebutton.view.BlueButton.Home', {    extend: 'Ext.Container',
        xtype: 'homecard',
           requires: [
        'Utility.NumPad'
           
        ],
        config: {
            iconCls: 'add_black',
            title :'Add Point',
            styleHtmlContent: true,
            cls: 'styledContent',
            scrollable: 'vertical',
            items:[
            {
    
    
                
                 xtype :'numpad',
           
    
    
    //                xtype :'keypad',
    //                ui :'small',
                   
    
    
                }
       
    ]  
        },
    
    
       
    });
    Please guild me a solution, Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,107
    Vote Rating
    453
    Answers
    3156
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    The code mentioned at https://github.com/msmeeks/sencha-keypad is for ST1 and not ST2.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

Tags for this Thread