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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:23:02+00:00 2026-06-11T06:23:02+00:00

each item in my dataview has a text and a div which represents a

  • 0

each item in my dataview has a text and a div which represents a button. The button is only shown when the mouse is over the item. How can i handle a mouseclick on the button-div?

What i have so far is this:

xtype: 'dataview',

store: Ext.create('Ext.data.Store', {
    model: 'LogEntry',
    data: [
        { text: 'item 1' },
        { text: 'item 2' },
        { text: 'item 3' },
        { text: 'item 4' },
        { text: 'item 5' }
    ]
}),

tpl: Ext.create('Ext.XTemplate',
    '<tpl for=".">',
        '<div class="logentry">',
            '<span>{text}</span>',
            '<div class="removeicon"></div>',
        '</div>',
    '</tpl>'
),

itemSelector: 'div.logentry',
trackOver: true,
overItemCls: 'logentry-hover',

listeners: {
    'itemclick': function(view, record, item, idx, event, opts) {
        // How can i distinguish here if the delete-div has been clicked or some other part of the dataview-entry?
        console.warn('This item respresents the whole row:', item);
    }
}

Working example: http://jsfiddle.net/suamikim/3ZNTA/

The problem is that i can’t distinguish in the itemclick-handler if the button-div or the text-span has been clicked.

Thanks & best regards,
Mik

  • 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-11T06:23:04+00:00Added an answer on June 11, 2026 at 6:23 am

    check the event.target.className in the event listener. Here is a working example:

    http://jsfiddle.net/3ZNTA/1/

    Here’s the code:

    Ext.onReady(function() {
        Ext.define('LogEntry', {
            extend: 'Ext.data.Model',
            fields: [
                { name: 'text',    type: 'string' }
            ]
        });
    
        Ext.create('Ext.panel.Panel', {
            width: 500,
            height: 300,
            renderTo: Ext.getBody(),
    
            layout: 'fit',
    
            items: [{
                xtype: 'dataview',
    
                store: Ext.create('Ext.data.Store', {
                    model: 'LogEntry',
                    data: [
                        { text: 'item 1' },
                        { text: 'item 2' },
                        { text: 'item 3' },
                        { text: 'item 4' },
                        { text: 'item 5' }
                    ]
                }),
    
                tpl: Ext.create('Ext.XTemplate',
                    '<tpl for=".">',
                        '<div class="logentry">',
                            '<span>{text}</span>',
                            '<div class="removeicon"></div>',
                        '</div>',
                    '</tpl>'
                ),
    
                itemSelector: 'div.logentry',
                trackOver: true,
                overItemCls: 'logentry-hover',
    
                listeners: {
                    'itemclick': function(view, record, item, idx, event, opts) {
    
                        if(event.target.className === 'removeicon'){
                            alert('you clicked the x icon');
                        }
    
                        // How can i distinguish here if the delete-div has been clicked or some other part of the dataview-entry?
                        console.warn('This item respresents the whole row:', item);
                    }
                }
            }]
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Each user can vote once per item (only registered users can vote). So I
I have a ListView in which each item has a SeekBar. When I update
I am using listview in which each item (of list view) has a checkbox
I have a list, each item of which has several things in it, including
I have a list and each item has a button. When I click the
I have a ListView where each item represents a podcast that can run up
I have ListPicker where each item is musical instrument. Only one item simultaneously can
For each item in my application's settings, I've added text to its Description Property
My stackpanels have gaps between each item (TextBlocks). You can see through to whatever
I have lists of variable length where each item can be one of four

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.