1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    swalker@pintnight.com is on a distinguished road

      0  

    Default Unanswered: Ext 4.1 Grid Searching Toolbar - cannot get it to display in paging toolbar

    I've been trying to add the Grid Searching to the paging toolbar and I'm not having much success of getting it to load.

    I'm using the latest (I believe) that was modified by Fabio Frijo from this: http://www.sencha.com/forum/showthre...424&viewfull=1

    What am I'm doing wrong?

    My Code:

    Code:
    /*
     * File: app/view/Contacts.js
     *
     */
    
    var searching = {
        ftype: 'searching',
        minChars: 2,
        mode: 'local'
    };
    
    Ext.define('Contacts.view.Contacts', {
        extend: 'Ext.grid.Panel',
    
        renderTo: 'maincontentarea-body',
        id: 'contacts-container',
    
        title: 'Contacts',
        store: 'Contacts.store.Contacts',
    
        border: false,
    
        stateful: true,
        stateId: 'stateGrid',
    
        layout: {
            type: 'fit'
        },
    
        // Need this to get the scroll bar to display, but we don't want the height,
        // we want the height to fill in automatically
        height: 1000,
    
        resizable: true,
    
        initComponent: function() {
            var me = this;
    
            Ext.applyIf(me, {
                columns: [
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'firstname',
                        flex: 1,
                        text: 'First Name',
                        sortable: true
                    },
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'lastname',
                        flex: 1,
                        text: 'Last Name',
                        sortable: true
                    },
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'company',
                        flex: 1,
                        text: 'Company',
                        sortable: true
                    },
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'email',
                        flex: 1,
                        text: 'Email',
                        sortable: true
                    }
                ],
                listeners: {
                    afterrender:function() {
                        console.log( 'afterrender ' +this.getHeight())
                    },
                    boxready:function() {
                        console.log( 'boxready ' +this.getHeight())
                    },
                    resize:function() {
                        console.log( 'resize ' +this.getHeight())
                    }
                },
                viewConfig: {
                    trackOver: false,
                    listeners: {
                        itemdblclick: {
                            fn: me.onGridviewItemDblClick,
                            scope: me
                        }
                    }
                },
                /*
                plugins: [
                    new Ext.ux.grid.Search({
                        iconCls: 'icon-zoom',
                        readonlyIndexes: ['note'],
                        disableIndexes: ['pctChange'],
                        minChars: 2,
                        autoFocus: true
                        //menuStyle: 'radio'
                    }), this.rowActions
                ],
                */
                initTopToolbar: function(){
                    return Ext.create('Ext.ux.toolbar.GridSearching', {
                        grid            : this,
                        menuPosition    : 'right',
                        menuIconCls        : 'icon-config',
                        inputWidth        : 200,
                        showSelectAll    : false,
                        menuText        : null,
                        menuTip            : 'mooSearch Menu Tip',
                        inputTip        : 'mooSearch Input Tip',
                        disableIndexes    : ['trad_strumento','trad_metodo'],
                        items            : ['->', this.getAddButton()]
                        });
                },
                dockedItems: [
                    {
                        xtype: 'toolbar',
                        dock: 'top',
                        items: [
                            {
                                xtype: 'button',
                                text: 'New'
                            },
                            {
                                xtype: 'button',
                                text: 'Edit'
                            },
                            {
                                xtype: 'button',
                                text: 'Delete'
                            }
                        ]
                    },
                    {
                        xtype: 'pagingtoolbar',
                        dock: 'top',
                        autoShow: true,
                        displayInfo: true,
                        store: 'Contacts.store.Contacts',
                        displayMsg: 'Displaying contacts {0} - {1} of {2}',
                        emptyMsg: "No contacts",
                        /*
                        items: [
                            '-',
                            {
                                text: 'Search',
                                pressed: false,
                                enableToggle: true,
                                toggleHandler: function(btn, pressed) {
                                    console.log('...contact search toggleHandler');
                                }
                            }
                        ]
                        */
                    }
                ]
            });
    
            Ext.QuickTips.init();
    
            me.callParent(arguments);
        },
    
        onGridviewItemDblClick: function(dataview, record, item, index, e, options) {
            console.log('...onGridviewItemDblClick: internalId: ' + record.internalId);
    
            var contactForm = new Ext.form.Panel({
                title: 'Contact Detail',
                id: 'contactFormPanel',
                width:425,
                frame:true,
                items: [
                    new Ext.form.TextField({
                        id:"firstname",
                        name: "firstname",
                        fieldLabel: 'First Name',
                        anchor: '100%',
                        //width:275,
                        allowBlank:false,
                        readOnly: false,
                        listeners: {
                            afterrender: function(field) {
                                field.focus(false, 250);
                            }
                        }
                    }),
                    new Ext.form.TextField({
                        id:"lastname",
                        name: "lastname",
                        fieldLabel: 'Last Name',
                        anchor: '100%',
                        allowBlank:false,
                        readOnly: false
                    }),
                    new Ext.form.TextField({
                        id:"company",
                        name: "company",
                        fieldLabel: 'Company',
                        anchor: '100%',
                        allowBlank:false,
                        readOnly: false
                    }),
                    new Ext.form.TextField({
                        id:"email",
                        name: "email",
                        fieldLabel: 'Email',
                        anchor: '100%',
                        allowBlank:false,
                        readOnly: false
                    })
                ],
                listeners: {
                    afterRender: function(form, options) {
                        this.keyNav = Ext.create('Ext.util.KeyNav', this.el, {
                            //enter: handleContactEnterKey,
                            //scope: this
                        });
                    }
                },
                dockedItems: [{
                    xtype: 'toolbar',
                    dock: 'bottom',
                    layout: {
                        pack: 'end',
                        type: 'hbox'
                    },
                    items: [
                    { 
                        xtype: 'button',
                        id: 'cancelFormButton',
                        text: 'Cancel',
                        listeners: {
                            click: {
                                fn: function(){ 
                                    contactPopup.close();
                                }
                            }
                        }
                    },
                    { 
                        xtype: 'button',
                        id: 'contactFormButton',
                        text: 'Save',
                        listeners: {
                            click: {
                                fn: function(){ 
                                    //handleLogin();
                                    contactPopup.close();
                                }
                            }
                        }
                    }
                    ]
                }]
            });
    
            var contactPopup = null;
    
            //create the popup menu on the first click and reuse on subsequent clicks
            if (!contactPopup) {
                contactPopup = new Ext.Window({
                    id: "contactDetailWindow",
                    layout: "fit",
                    draggable: false, //don't allow the window to be drag around the screen
                    resizable: false, //don't allow the window to be resize
                    closeable: true,
                    header: false,
                    border: false,
                    plain: true,
                    modal: true,
                    shadow: true,
                    width: 350,
                    constrain: true,
                    items: contactForm
                });
            }
    
            if (contactPopup.isVisible()) {
                contactPopup.hide();
            }
            else {
                contactPopup.show();
            }
        }
    });

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,396
    Vote Rating
    1101
    Answers
    3680
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    When you instantiate Contacts.view.Contacts are you passing dockedItems config?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    swalker@pintnight.com is on a distinguished road

      0  

    Default

    Yes, if you look at my code, you will see dockedItems in initComponent:. Unless I'm not understanding your question.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,396
    Vote Rating
    1101
    Answers
    3680
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    Ext.applyIf will only set the dockedItems if dockedItems is not already set. So if you pass in dockedItems when you create an instance, the dockedItems in the initComponent won't be set because dockedItems will already exists on this
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  5. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    swalker@pintnight.com is on a distinguished road

      0  

    Default

    Hi Mitchell,

    I'm trying to understand what you were trying to say. I'm fairly new to Ext JS and still trying to get my brain to understand all of the components of how everything works together. Can you explain to me what you mean by 'the dockeditems in the initComponent won't be set because doeckeditems will already exits on this'?

    Where exactly do I add Ext.ux.toolbar.GridSearching to the paging toolbar to get it load properly? Is there any better examples for me to look over?

  6. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    swalker@pintnight.com is on a distinguished road

      0  

    Default

    Bump?

Thread Participants: 1