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 8509881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:33:15+00:00 2026-06-11T03:33:15+00:00

Am having a delete button in my EXTJS Application. On clicking the button, am

  • 0

Am having a delete button in my EXTJS Application. On clicking the button, am opening a confirmation form, asking the user are they sure to delete the item. The delete button is a part of many forms in my Application. And irrespective of the form being used, am opening the confirmation window.

And on clicking the yes button in the confirmation window, i want to do some action. But these actions have to be specific to the form that was opened first.So, am confused about how to use the same view, the same button, but different actions depending upon the first form that was opened.

View: This is the window that opens on clicking the delete button in any of the forms

  Ext.define('app.view.GenMessageWin', {
extend : 'Ext.panel.Panel',
alias : 'widget.genmessagewin',

  var fp = {
        xtype : 'panel',
        itemId : 'MSGPANEL',
        width : Width,
        height : 150,
        cls : 'msg effect1',
        layout : 'form',
        border : false,
        items : [{
            xtype : 'panel',
            //cls : 'winTitle',
            html : msgTxt,
            border : 0
        }, {
            xtype : 'form',
            itemId : 'MSGFORM',
            border : false,
            title : '',
            buttonAlign : 'center',
            fieldDefaults : {
                msgTarget : 'side',
                labelWidth : 110,
                size : 30
            },

            buttons : [{
                text : LANG.BTYES,
                iconCls : 'icon-tick-tb',
                iconAlign : 'right',
                cls : 'tip-btn',
                action : 'delete',
                id : 'BTYES'
            }, {
                text : LANG.BTNO,
                iconCls : 'icon-cross-tb',
                iconAlign : 'right',
                cls : 'tip-btn',
                action : 'notDelete',
                id : 'BTNO'
            } ]

Controller

        init : function() {

         this.control({

        'button[action = delete]' : {
            click : this.delete
        },
        'button[action = notDelete]' : {
            click : this.notDelete
        },

So, in the delete action, we have to determine which form has been opened in the first place, and then delete the data accordingly.

  • 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-11T03:33:16+00:00Added an answer on June 11, 2026 at 3:33 am

    You have 3 options:

    1) Make the selector more specific:

    'form1 button[action=delete]': {
        click: this.form1Delete
    },
    
    form1Delete: function(){
        this.showMsg(function() {
            // form 1 delete
        });
    }
    

    2) Traverse back up the component hierarchy and find the open form

    onDelete: function(btn) {
        var form = btn.up('form'); // find an xtype form or subclass
        if (form.someCondition) {
           //foo
        } else {
            //bar
        }
    }
    

    3) As suggested by Dmitry. You’ll need to convert it over to ‘MVC style’.

    Ext.define('ConfirmButton', {
        extend: 'Ext.button.Button',
    
        title: '',
        msg: '',
    
        requires: ['Ext.window.MessageBox'],
    
        initComponent: function(){
            this.callParent();
            this.on('click', this.handleClick, this);
        },
    
        handleClick: function(){
            Ext.MessageBox.confirm(this.title, this.msg, this.checkResponse, this);
        },
    
        checkResponse: function(btn){
            if (btn == 'yes') {
                this.fireEvent('confirm', this);
            }
        }
    });
    
    Ext.onReady(function(){
    
        var btn = new ConfirmButton({
            renderTo: document.body,
            text: 'Foo',
            title: 'Should I',
            msg: 'Are you sure'
        });
    
        btn.on('confirm', function(){
            console.log('Do something');
        })
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a problem with delete and destructor (I am sure I am
I want to prompt the user for confirmation when he tries to delete a
I am Having an application where, if the user enters data the rows will
I'm currently working with a part of my application that uses Dynamic Web User
I am having a Gridview. I had placed a delete button in the last
I have mvc 3 application in which i'm having one input form on Index.cshtml
Having tried several solutions to get NHibernate to delete orphan records. Given the following
I'm having trouble figuring out how to delete a set of records when a
I am having a big issue trying to delete from an UITableView. Just for
I need to add and delete class on an element having multiple classes: This

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.