Results 1 to 8 of 8

Thread: Menu on close not destroyed

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default Menu on close not destroyed

    REQUIRED INFORMATION

    Ext version tested:

    • Ext 4.0.6

    Browser versions tested against:
    • FF7
    • Chrome

    DOCTYPE tested against:
    • Strict
    • Transitional

    Description:
    • an menu will not destroyed on close

    Steps to reproduce the problem:
    • create a contextmenu
    • close it

    The result that was expected:
    • all dom element should destroyed

    The result that occurs instead:
    • menu is only hide element and can be find in body dom

  2. #2
    Sencha - Services Team
    Join Date
    Aug 2007
    Posts
    98

    Default

    Please provide the source code for a concise test case that demonstrates the issue using the smallest amount of code possible, that does not have any external dependencies, that has all needed data available to be loaded locally (using a json or xml flat file), and that is locally runnable and we will do our best to investigate it.

  3. #3
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default

    Code:
      var data = [
        { name: 'Name 1', category: 'Group 1'},
        { name: 'Name 2', category: 'Group 2'},
        { name: 'Name 3', category: 'Group 1'},
        { name: 'Name 4', category: 'Group 2'},
        { name: 'Name 5', category: 'Group 1'},
        { name: 'Name 6', category: 'Group 2'},
        { name: 'Name 7', category: 'Group 1'},
        { name: 'Name 8', category: 'Group 3'},
        { name: 'Name 9', category: 'Group 1'},
        { name: 'Name 10', category: 'Group 2'},
        { name: 'Name 11', category: 'Group 1'},
        { name: 'Name 12', category: 'Group 4'},
        { name: 'Name 13', category: 'Group 1'}
      ]
    
      Ext.create('Ext.data.Store', {
        storeId:'sampleStore',
        fields:['name', 'category'],
        groupField: 'category',
        proxy: {
          type: 'memory',
          reader: {
            type: 'json',
            root: 'items'
          }
        },
        data: {
          items: data
        }
      });
    
      var groupingFeature = Ext.create('Ext.grid.feature.Grouping', {})
    
    
      Ext.onReady(function() {
    
    
        var test4 = Ext.create('Ext.grid.Panel', {
          height: 300,
          frame: true,
          selModel: 'cell',
          features: [groupingFeature],
          title: 'Test4',
          renderTo: 'test4',
          store: Ext.data.StoreManager.lookup('sampleStore'),
          tbar:[
            {
              text: 'Display LoadMask',
              handler: function() {
                test4.view.loadMask.show();
              }
            }
          ],
          columns: [
            {
              header: 'Name',
              dataIndex: 'name'
            },
            {
              header: 'Category',
              dataIndex: 'category'
            }
          ],
          viewConfig: {
            listeners: {
              cellcontextmenu: function(view, cell, cellIndex, record, row, rowIndex, e) {
                e.stopEvent();
                var menu = Ext.create('Ext.menu.Menu', {
                  items: [
                    {
                      text: 'Bearbeiten',
                      scope: this
                    },
                    {
                      text: 'Lschen',
                      scope: this
                    },
                    {
                      itemId: 'status',
                      text: 'Wichtigkeit',
                      menu: [
                        {
                          itemId: 'normal',
                          text: 'Normal',
                          scope: this
                        },
                        {
                          itemId: 'high',
                          text: 'Hoch',
                          scope: this
                        },
                        {
                          itemId: 'reserved',
                          text: 'Reserviert',
                          scope: this
                        }
                      ]
                    }
                  ]
                });
                menu.showAt(e.xy);
              }
            }
          }
        });
    
      });
    here a sample. yes i know it is better to reuse the menu

  4. #4
    Sencha - Services Team
    Join Date
    Aug 2007
    Posts
    98

    Default

    Unless there is something we are not seeing in your test case, this is the expected behavior of the menu. In our judgment, reusing the menu (as you admit in your prior post) rather than recreating it every time alleviates the issue you are seeing. If you can provide any other relevant information, we will investigate this issue further.

  5. #5
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    Agree with Mark here. The most common use case is to reuse the same menu with the same options. If you want this behaviour you should destroy the menu and recreate it where appropriate.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  6. #6
    Ext JS Premium Member
    Join Date
    Jul 2010
    Posts
    3

    Default

    in the most time we reuse an menu. but sometimes you have in complex szenaries and must build the menu everytime.

    If you want this behaviour you should destroy the menu and recreate it where appropriate.
    in the api doc, you have an option "closeAction". but this will be ignored. so it is a bug for me.

  7. #7
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    From the docs:

    The action to take when the close header tool is clicked
    The menu doesn't have a close header tool.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  8. #8
    Ext JS Premium Member
    Join Date
    Jul 2010
    Posts
    3

    Default

    no comment

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
  •