Rutwick Gangurde
Rutwick Gangurde

Reputation: 4912

ExtJs - Textfield rendered via renderer doesn't get click focus?

I'm using a propertyGrid for building a tabular from. When I use a renderer to return a textfield, I can't click and type in that textfield. It doesn't get any focus. Any way to fix it? Also, is there a way to render an ExtJs element instead of a raw HTML element from a renderer?

Upvotes: 0

Views: 1560

Answers (1)

Sreek521
Sreek521

Reputation: 669

In grid,column renderers only return HTML text, so it's not possible to return components directly. The only thing is assign a unique id to the cell and defer the actual component creation.

  {
            header: 'Row7',
            align: 'center',
            renderer: renderCmp,
            dataIndex: 'cmpname',
            width: 100
        }


// Renderer function
    function renderCmp(value, id, r)
    {

            var id = Ext.id();
            if (r.data.cmpname )
            {
                createGridButton.defer(10, this, ['One', id, r]);
                return('<div id="' + id + '"></div>');
            }else
            {
                createGridButton.defer(10, this, ['Two', id, r]);
                return('<div id="' + id + '"></div>');
            }

    }
    function createGridButton(value, id, record) {
        new Ext.Button({
            text: value,
            iconCls: 'my-icon',
            handler : function(btn, e) {
                alert('Componet in Row');
            }
        }).render(document.body, id);
    }

Hope it helps you..

Upvotes: 2

Related Questions