Results 1 to 3 of 3

Thread: How can i show ColorPalette on focus event in the textfield ?

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Cuttack,Odisha,India
    Posts
    62

    Question How can i show ColorPalette on focus event in the textfield ?

    I have seen the example showing ColorPalette by clicking a button.But i want show it in textfield on focus event in the textfield.

    Code:
    var col = new Ext.ColorPalette({
                        listeners: {
                            select: function(cp, color){
                                alert(color);
                            }
                        }
                    });
                    var frm_color = new Ext.form.TextField({
                        fieldLabel: 'Add a color',
                        name: 'color',
                        id: 'color',
                        width: 190,
                        listeners: { 
                            focus : function()
                            {
                                item:[col];
                            }
                        },        
                    });
    what is the alternative method to do it ?

    thanks in advance.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    Probably not 100% what you want but this will render it to the body:

    Code:
        var col = new Ext.ColorPalette({
            listeners : {
                select : function(cp, color){
                    console.log(color);
                }
            }
        });
    
        var form = new Ext.form.FormPanel({
            renderTo : Ext.getBody(),
            width    : 400,
            height   : 400,
            items    : [
                {
                    xtype      : 'textfield',
                    fieldLabel : 'Test',
                    listeners  : {
                        focus : function(field) {
                            col.render(Ext.getBody());
                        }
                    }
                }
            ]
        });
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Cuttack,Odisha,India
    Posts
    62

    Default

    Thanks mitchellsimoens .It could be an alternative to that problem. thanks very much.

Posting Permissions

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