Jump to content

How can I prevent OnMouseDown event of parent control.


abhimanyu

Recommended Posts

Hi,

Panel and control over the panel, both having a OnMouseDown event. When click on panel it works fine but when click on control which is over the panel then it calling two events firstly control's mousedown and then panel's mousedown so I want only one event has to be called. If click on control it should be call control's mousedown not panel's mousedown. 

How  did I prevent parent's mousdown event?

Link to comment
Share on other sites

Can you try this approach for now?!:

 

Your Panel -> ClientEvents -> ExtEvents -> function boxready:

function boxready(sender, width, height, eOpts)
{
    sender.items.each(function(el) {
        var me=Ext.get(el.id);
        if (me) {
            me.dom.addEventListener('mousedown', function(e) {
                e.stopPropagation();
            })
        }
    })
}

Try..

 

Best regards.

Link to comment
Share on other sites

Can you try this approach for now?!:

 

Your Panel -> ClientEvents -> ExtEvents -> function boxready:

function boxready(sender, width, height, eOpts)
{
    sender.items.each(function(el) {
        var me=Ext.get(el.id);
        if (me) {
            me.dom.addEventListener('mousedown', function(e) {
                e.stopPropagation();
            })
        }
    })
}

Try..

 

Best regards.

 

due to this the child control's popup are occurring but when I click on parent then it also not showing parent's popup. It have to show parent's popup when click on parent and child's popup when click on child control

Link to comment
Share on other sites

Hi,

 

I want second edit box and grid need to call parent popup.

 

then can you try this approach for now?!:

function boxready(sender, width, height, eOpts) {
    sender.items.each(function(el) {
        Ext.defer(function() {
            var me = Ext.get(el.id);
            var mousedownEvents = el.hasListener('mousedown');

            if (me && mousedownEvents) {
                me.dom.addEventListener('mousedown', function(e) {
                    e.stopPropagation();
                })
            }
        }, 50);
    })
}

Best regards.

Link to comment
Share on other sites

Hi,

 

You can use a recursive traversal in the above code I guess

But what if you will use this solution to your needed controls?!:

 

For example for UniDBEdit1:

 

UniDBEdit1 -> ClientEvents -> ExtEvents -> function afterrender:

function afterrender(sender, eOpts)
{
    sender.getEl().dom.addEventListener('mousedown', function(e) {
        e.stopPropagation();
    })
}

Best regards.

Link to comment
Share on other sites

  • 4 years later...

Hi Sherzod

where can i find documentation about 

sender.getEl().dom.addEventListener('mousedown', function(e) {
        e.stopPropagation();
    })

what is sender - the object owen the evennts? how can i use it inside ext evenet - like mouse down.

what is geEL()

is dom is not the ALL "page document"

where the "e" came from ?

addEventListener - where can i find list of all the functions?

i treid stop the mousedown event of UniPDFFrame - no success

Link to comment
Share on other sites

  • 3 months later...

Hello,

in unimDBListGrid :

Sample Code On Server Side :


procedure TMainmForm.unimDBListGrid1Click(Sender: TObject);
begin
   unimMemo1.Lines.Add('on Click');
end;

procedure TMainmForm.unimDBListGrid1Disclose(Sender: TObject);
begin
   unimMemo1.Lines.Add('on Disclose');
end;


Sample Code On Client Side :

function childtap(sender, location, eOpts)
{
   console.log('On Tap');
}

function disclose(list, record, target, index, event, eOpts)
{
   //event.stopEvent();
   //event.stopPropagation();
   
   console.log('On Disclose');
}

function initialize(sender, eOpts)
{
    sender.items.each(function(el) {
        var me=Ext.get(el.id);
        if (me) {
            me.dom.addEventListener('childtap', function(e) {
                e.stopPropagation();
            })
        }
    })
   
   //sender.getEl().dom.addEventListener('childtap', function(e) {
   //     e.stopPropagation();
   // })
}

On ChildTap still execute when click/tap disclosure. How to workaround ?

build1555

Thanks in advance.

disclose.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...