1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Tokyo, Japan
    Posts
    7
    Vote Rating
    0
    ryu1kn is on a distinguished road

      0  

    Default Unanswered: setScrollable(false) doesn't take effect once you do setScrollable(true)

    Unanswered: setScrollable(false) doesn't take effect once you do setScrollable(true)


    It seems you cannot set scrollable disabled once you do setScrollable(true). Please try the code below.

    Is there any way that I can reset/initialise the scrollable setting but not just disabling it? (Like actionsheet.getScrollable().getScroller().setDisabled(true))

    With the scrollable enabled, it looks like I've got to give the height so that the actionsheet doesn't get squashed. As it's hard to know how tall the height should be when i'm coding, I don't want to specify it.

    Code:
    Ext.define("ToggleScrollable.view.Main", {
        extend: 'Ext.Panel',
        fullscreen: true,
        config: {
            items: [{
                xtype: 'actionsheet',
                height: 150,
                hideOnMaskTap: true,
                items: [{
                    text: 'Do nothing'
                }, {
                    text: 'Do nothing, either',
                }]
            }, {
                xtype: 'button',
                text: 'Show ActionSheet',
                listeners: {
                    tap: function () {
                        this.up('panel').down('actionsheet').show();
                    }
                }
            }, {
                xtype: 'button',
                text: 'Toggle ActionSheet#scrollable',
                state: false,
                listeners: {
                    tap: function () {
                        var panel = this.up('panel'),
                            sheet = panel.down('actionsheet');
                        panel.setHtml('<div>set scrollable: ' + this.state + '</div>');
                        if (this.state) {
                            sheet.setScrollable(this.state);
                        }
                        this.state = !this.state;
                    }
                }
            }]
        }
    });

  2. #2
    Sencha User
    Join Date
    May 2012
    Location
    Tokyo, Japan
    Posts
    7
    Vote Rating
    0
    ryu1kn is on a distinguished road

      0  

    Default


    Oops sorry, it's just my fault.

    Scrollable didn't get disabled because i had

    Code:
    if (this.state) {
        sheet.setScrollable(this.state);
    }
    Simply removing 'if' fixed the problem

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Tokyo, Japan
    Posts
    7
    Vote Rating
    0
    ryu1kn is on a distinguished road

      0  

    Default


    Alright, it would be a bit confusing because of my initial post with the test code that has unnecessary 'if', but I found out the problem does actually exist.

    Removing 'if' works with ST2.0.1.1 but not with ST2.1.0.

    For now, I do sheet.getScrollable().destroy() to make the sheet unscrollable.

    Anyway, I've reported this to the Bugs forum.

  4. #4
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Vote Rating
    20
    Answers
    64
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    You want to disable scroller ,why you set it false?scroller is a object ,not boolean value.
    Code:
    if(sheet.getScrollable()){// if the scroller has been created
        sheet.getScrollable().getScroller().setDisabled(this.state);
    }else{
        sheet.setScrollable(this.state);
    }
    I write English by translator.

Thread Participants: 1

Tags for this Thread