Results 1 to 6 of 6

Thread: stop a panel from collapsing

  1. #1

    Default stop a panel from collapsing

    Hello, guys, I was wondering is there any way to stop a panel from collapsing. Here is my use case. When a panel is closed an Ajax call is initiated and until that ajax call is not completed I will not be closing that panel.

    Now I have added the listeners to it like onBerforeCollapse or collapse. Now according to my understanding, I will need to do something in onBeforeCollapse because the collapse one is called only if the section is collapsed So I'm thing of stopping the collapse in onBeforeCollapse function and then collapsing that section in the success callback of Ajax

    But the only problem that I'm facing is that I can't understand how to stop collapsing so if help will be appreciated

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    If you aren't ready to allow the collapse, return false from within the beforecollapse event function.
    https://fiddle.sencha.com/#view/editor&fiddle/1u64

  3. #3

    Default

    @Gary the problem is that if I return false all the other events that are being called are stopped. I don't want to stop all other events. I need them to work as they are working.

    Here is what is happening in my application. there are multiple panels and all of these panels depend on one panel let say it's A. Now the requirement that I have is when we try to collapse panel A it should only collapse when the ajax call is completed

  4. #4

    Default

    anybody any idea ??

  5. #5
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    Something like:
    Code:
    Ext.create('Ext.panel.Panel', {
                title: 'Hello',
                width: 200,
                html: '<p>World!</p>',
                closable: true,
                requestGemacht: false,
                listeners: {
                    beforeclose: function (panel) {
                        if(panel.requestGemacht) {
                            return true;
                        }
                        Ext.Ajax.request({
                            url: '/theUrl.json',
    
    
                            success: function (response, opts) {
                                panel.requestGemacht = true;
                                panel.close();
                            },
    
    
                            failure: function (response, opts) {
                                console.log('server-side failure with status code ' + response.status);
                            },
                            scope: this
                        });
                        return false;
                    }
                },
                renderTo: Ext.getBody()
            });
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  6. #6

    Default

    the problem is that this is being called twice on the second time it collapses and then calls the other callback like expand collapse etc I want it not to collapse and keep on calling the other callback.

Similar Threads

  1. Replies: 1
    Last Post: 9 Oct 2014, 10:08 PM
  2. Stop combobox from collapsing when [+] in tree within combobox is clicked
    By shahdollie in forum Ext 3.x: Help & Discussion
    Replies: 13
    Last Post: 17 Nov 2010, 1:53 PM
  3. Nested panel doesn't fill open space after collapsing parent panel
    By michiel in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 22 Aug 2007, 6:46 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •