Building a TriggerField with PopUp Window

Posted by umit_alba on Stack Overflow See other posts from Stack Overflow or by umit_alba
Published on 2010-04-12T13:07:34Z Indexed on 2010/04/16 9:33 UTC
Read the original article Hit count: 299

Filed under:

Hi!

I built a triggerField and when i press at it, i want to have a popup, that is appended to the button in the triggerfield(so when i click anywhere else it shall disappear and it shall pop out up to the button when i click at the button just like a datepicker-popup)

I somehow managed to do something like that with an Ext.window but the offset and postion doesnt match.

This all should be contained in a row editor. my Code:

new Ext.grid.GridPanel({
        store: Store,
        region:'center',
        height:150,
        //minWidth:700,
        autoScroll:true,
        listeners:{},
        plugins:[new Ext.ux.grid.RowEditor()],
      tbar: [{
            iconCls: 'icon-user-add',
            text: ' hinzufügen',
            handler: function(){
                alert("abc");
            }
        },{
            ref: '../removeBtn',
            iconCls: 'icon-user-delete',
            text: 'löschen',
            disabled: true,
            handler: function(){
                editor.stopEditing();
                var s = grid.getSelectionModel().getSelections();
                for(var i = 0, r; r = s[i]; i++){
                    store.remove(r);
                }
            }
        }],
        columns: [{
            header: 'Monate',
            dataIndex: 'MONAT',
            width: 50,
            sortable: true,
            editor: 
                new Ext.form.TriggerField({"id":"EditorMonate",items:[],
                    "onTriggerClick":function(thiss){
                    if(!Ext.getCmp("autoWMonate")){
                    var monate=new Ext.Window({"x":Ext.getCmp("EditorMonate").x,closeAction:"hide",width:275,id:"autoWMonate",layout:"table",layoutConfig: {columns: 10}});
                    var text;
                    for(var mon=1;mon<13;mon++){
                    text=mon;
                    mon?mon:text="0";
                    if(mon<10)
                        text="0"+mon;
                            monate.items.add(
new Ext.Button({cls:"x-btn",value:parseInt(text),selected:true,"text":text,id:text
                        }}}));}
                    }              Ext.getCmp("autoWMonate").hidden?Ext.getCmp("autoWMonate").show():Ext.getCmp("autoWMonate").hide();
                }})
        }
        }]
    })

© Stack Overflow or respective owner

Related posts about extjs