Results 1 to 2 of 2

Thread: Not able to load keypad plugins

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,332
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    The code mentioned at https://github.com/msmeeks/sencha-keypad is for ST1 and not ST2.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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