Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8701363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:22:52+00:00 2026-06-13T02:22:52+00:00

I want the close button to be reusable so I created its own class

  • 0

I want the close button to be reusable so I created its own class so I can attach it to the views that need it. I want to just be able to pass the view that is attached to the view to the controller to close that view. It should be fairly simple and I would suspect that this is how many do it but I can’t get it to work correctly. I get it to close the view but get the error
Uncaught TypeError: Cannot read property ‘dom’ of null
I understand this to generally mean that the view isn’t being destroyed but I thought this told it to destroy the view:

Ext.Viewport.remove(curView, true);

Here is what I believe to be the pertinent code
Controller:

closeView: function(btn, e,opts){             
            var curView = btn.getParent().getParent();
           console.log('From btn: ' + curView + ',' + opts);             
           Ext.Viewport.remove(curView, true);}

View:

Ext.define('SenchaFirstApp.view.DetailView',{
      extend: 'Ext.tab.Panel',
      requires: ['Ext.Toolbar', 'Ext.tab.Panel', 'Ext.form.FieldSet', 'Ext.field.Select'],
      model: ['SenchaFirstApp.model.Details', 'SenchaFirstApp.model.SiteInfo'],
      alias: 'widget.detailview',
//      xtype: 'tabpanel',


    config:
    {
          scrollable: true,
          width: 1500,
          height: 800,
    //      fullscreen: true,
          layout: {type: 'card', animation:{type: 'flip'}},
          centered: true,
          border: 10,
          tabBar: {
              docked: 'top',
          }, 
          formParams: {
        },
      items: 
      [
       {
         //Tab bar 
         xtype:  'tbar',
         title: 'Details View',
             items: [
            {
              xtype: 'closebtn',
              id: 'detailsBtn',
              sourceForm: this
            }]
        },
        {
            title: 'Equipment Monitor',        //first tab
            xtype: 'monitor',
        },                        
        {
            title: 'Site Information',            //second tab
            xtype: 'siteinfo',
        }
    ]                    
} //End Config

I tried to use

Ext.Viewport.remove(Ext.Viewport.getActiveItem, true)

but that also didn’t work. I suspect that has to do with how I created that view maybe. I’m new to Sencha so there could be many things I’m doing wrong so I appreciate the help.

I forgot to mention that, after closing the tab panel, I can’t open it again without refreshing which again I’m sure is due to the view not being destroyed

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:22:54+00:00Added an answer on June 13, 2026 at 2:22 am

    It appears that the problem was using id’s. I thought that I took them out but I guess not. I took the id’s out and used alias’s and got it working. I’m still not figuring out how to pass the view attached to the button but now

    Ext.Viewport.remove(Ext.Viewport.getActiveItem, true)
    

    is working. The true property tells it to destroy the view after removing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a button that is basically Windows' close button. How could
How can I define an alternate close button for jQuery dialog? I want an
I want to show a message when user click on close button that ARE
I want to add close button, that overlapping Bootstrap modal. Here what I have:
every one. I just want to make the Close button disabled on a button
i want a close button at the end of AutoCompleteTextView so that on click
i want to create a custom close button in window style that it relyes
I have a facebox window with a close button that i want to be
I want to achieve an effect where a close button appears after some time
I have a jdialog and want close it on confirmation after that store the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.