Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default Add a custom button to the roweditor & shortcuts

    Add a custom button to the roweditor & shortcuts


    I need to add some custom buttons to the row editor. I've looked at the code for the rowediting plugin & the roweditor, and I don't think extending them would allow me to do what I'd like, which means I'd have to rewrite the file. If I do that, though, framework changes could break a lot.

    I also need to create a carry-value-over shortcut (Ctrl+-> moves the value in the current cell to the next one). It seems keynav is the place to do it?

    This is my first time doing something like this. Any ideas on how to start?
    word

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,862
    Vote Rating
    438
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    What problems do you see with creating an extension?

    Scott.

  3. #3
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default


    I can't see where I could add buttons. It seems they are creating them in Rowediting.initEditor(), which is not extensible, seeing as it creates the row editor at the end.

    Currently, a friend suggested I use interceptAfter. Here's what he used:
    Code:
            //Create the row editor
            rowEd = Ext.create('Ext.grid.plugin.RowEditing', {
                pluginId: 'roweditor',
                autoCancel: false,
                buttons: [{
                    xtype : 'button',
                    action: 'sayhi',
                    text: "HI"
                    maxWidth: 22
                },{
                    xtype : 'button',
                    action : 'saybye',
                    text: "BYE"
                    maxWidth: 22
                }]
            });
            //Add an intercept to allow buttons to be added to the editor
            Ext.Function.interceptAfter(rowEd,'startEdit',function(){
                var me = this;
                var floatPanel = me.editor.floatingButtons;
                if ((me.hasOwnProperty('buttons') && me.buttons.length >0) && floatPanel.items.getCount() == 2){
                    Ext.each(me.buttons,function(item){
                        var btn = floatPanel.add(item);
                        
                        floatPanel.setWidth(floatPanel.getWidth()+btn.getWidth()+5);
                    })
                }
                //Fix border width
                floatPanel.getEl().down('.x-grid-row-editor-buttons-bc').setWidth(floatPanel.getWidth()-6); 
                floatPanel.doLayout();
            },rowEd);
    Last edited by castitas; 22 May 2012 at 11:20 AM. Reason: updated code
    word

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,862
    Vote Rating
    438
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I have never tried the approach. Does it seems to work as expected? I would most likely copy the UX in my own DIR and start making changes as needed.

    Regards,
    Scott.

  5. #5
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default


    The buttons appear, are sized correctly, and can take icons, but I can't figure out how to get a reaction off of them (ie in the controller). I'm working on that now. My only worry is maintainability (how could you find this sort of thing) and performance (which is not a big deal, seeing as it's javascript).
    word

  6. #6
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default


    I finally found the buttons config. It's in getFloatingButtons. So I guess I could extend the class and override the function.

    Edit:
    What I did.
    Code:
    Ext.grid.RowEditor.override({
        getFloatingButtons: function() {
            ....
    
            if (!me.floatingButtons) {
                btns = me.floatingButtons = new Ext.Container({
                    renderTpl: [
                        ....
                        '<div class="{baseCls}-bc" style="width:###px"></div>',
                        '{%this.renderContainer(out,values)%}'
                    ],
                    items[{
                        ....
                    },{
                        //My buttons
                    }]
                ...
        }
    });
    You have to change the width to fit your new buttons.
    word

Thread Participants: 1