[CLOSED] SplitButton overflow menu not shown correctly - follow up

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] SplitButton overflow menu not shown correctly - follow up

    I would like to return briefly to the closed issue SplitButton overflow menu not shown correctly. As stated in the initial post of this issue, the actual implementation is much more complex, and in fact, the entire toolbar is dynamically rendered on the server side (based on registered classes, application config, etc.).

    Although the proposed solution works well when defining a toolbar explicitly in the view, when the code is running on the server side (as faintly indicated in the first post), the layoutDone function is again causing the same error as before: Cannot read property 'measuresBox' of null.

    I ineffectively spent hours trying to find a reason (maybe another timing when creating controls on the server side) and finally decided to implement the following:

    Ext.override(Ext.layout.Context, {
        layoutDone: function (layout) {
            var ownerContext = layout.ownerContext;
            if (!ownerContext) ownerContext = this.getCmp(layout.owner); // ADDED. This setting should be ok because ownerContext.el.target.itemId is the same as when opening window with enough width to avoid showing split button overflow menu
            layout.running = false;
            if (layout.isComponentLayout) {
                if (ownerContext.measuresBox) {
                    ownerContext.onBoxMeasured();
                }
                ownerContext.setProp('done', true);
            } else {
                ownerContext.setProp('containerLayoutDone', true);
            }
            --this.remainingLayouts;
            ++this.progressCount;
        }
    });
    According to my findings, ownerContext property has the same value in both cases when the toolbar is fully shown and overflowed (when error occurs and the code I inserted is applied), so I think it "should work".

    In the same thread, it was also recommended to use the menuShow listener for split buttons (see post #5). However, I found out that this does not work when the overflow menu is displayed, but no submenu is invoked (Print Option 1 and 2 in the example). However, when replacing the menuShow listener with the MenuTriggerOver, everything works as expected.

    In any case, I do not want to question the recommendations published in the above-mentioned issue, they have been of great value to me. This post is rather meant as a small "installment" for all the good advice I received from the support team and I hope it can help somebody.

    I do not expect any response to this post, but if my conclusions are not correct, you can close it and hide to others.

    Thank you for all the effort you devote to us and for always highly professional approach.

    Dan
    Last edited by fabricio.murta; Nov 06, 2018 at 4:58 AM. Reason: thread does not require feedback from the user

Similar Threads

  1. [CLOSED] SplitButton overflow menu not shown correctly
    By NewLink in forum 4.x Legacy Premium Help
    Replies: 11
    Last Post: Oct 10, 2018, 3:51 PM
  2. [CLOSED] Update SplitButton menu on DirectEvent?
    By rthiney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 07, 2013, 4:10 AM
  3. [CLOSED] Updating the Overflow Menu
    By musher in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 25, 2012, 2:40 PM
  4. [CLOSED] Splitbutton with Menu - Make the menu expand upwards?
    By rbarr in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 02, 2011, 1:18 PM
  5. [CLOSED] Images in SplitButton Menu off
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2010, 5:50 PM

Posting Permissions