Ext JS, item click listener doesn't seem to work


logo

I have a grid panel that shows all the users in my database. I want my grid items (rows) to be clickable because something happens when I click on them, but it seems there is nothing wrong with the listener.

    Ext.define('PRJ.view.Home', {
     extend: 'Ext.panel.Panel',
     alias: 'widget.home',
     title: 'Home',
     layout: 'fit',

     items: [
        {
            xtype: 'gridpanel',
            store: 'Users',
            title: 'Users grid',
            columns: [
                {text: 'Id', dataIndex: 'id' },
                {text: 'Name', dataIndex: 'name', width : 200 }
            ]
        }
    ]

    });


    Ext.define('PRJ.controller.Menu', {
     extend: 'Ext.app.Controller',

     refs: [
         {
            ref: 'centerPanel',
            selector: '#center-panel'
        }
     ],
     stores: ["Users"
     ],


     init: function() {
         this.control({
             'gridpanel': {
                 itemdblclick: this.editUser
             }
         });
     },

     editUser: function() {
         alert('User double clicked');
     },
});
Scriptable

This could be as simple as changing itemdblclick to rowdblclick.

I 've created a fiddle here showing a slightly different approach (by adding a listener to the config). code show as below:

Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [{
            text: 'Name',
            dataIndex: 'name'
        }, {
            text: 'Email',
            dataIndex: 'email',
            flex: 1
        }, {
            text: 'Phone',
            dataIndex: 'phone'
        }],
        listeners: {
            rowdblclick: function(grid, record, tr, rowIndex, e, eOpts) {
                alert(record.get("name"));
            }
        },
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
    });

You should also look at selecting models and row editing .

Related


Ext JS, item click listener doesn't seem to work

logo I have a grid panel that shows all the users in my database. I want my grid items (rows) to be clickable because something happens when I click on them, but it seems there is nothing wrong with the listener. Ext.define('PRJ.view.Home', { extend:

jQuery click event doesn't seem to work

Akahne Saikyo I'm practicing making a simple calculator using jQuery, and I think the code itself is pretty simple, but no matter what I do, absolutely nothing happens, as if there's no js file linked to beging. Here is the jQuery code: function ud(n){

VueJs 2 click doesn't seem to work

Dylan Glockler I'm not getting any errors and it's compiling so I'm not sure what I'm doing wrong.I searched for this topic without success. I have BulkExpenses.vue which pulls and displays some expense records, then BulkExpenses.vue is a nested component that

jQuery click event doesn't seem to work

Akahne Saikyo I'm practicing making a simple calculator using jQuery, and I think the code itself is pretty simple, but no matter what I do, absolutely nothing happens, as if there's no js file linked to beging. Here is the jQuery code: function ud(n){

VueJs 2 click doesn't seem to work

Dylan Glockler I'm not getting any errors and it's compiling so I'm not sure what I'm doing wrong. I searched for this topic without success. I have BulkExpenses.vue which pulls and displays some expense records, then BulkExpenses.vue is a nested component tha

jQuery click event doesn't seem to work

Akahne Saikyo I'm practicing making a simple calculator using jQuery, and I think the code itself is pretty simple, but no matter what I do, absolutely nothing happens, as if there's no js file linked to beging. Here is the jQuery code: function ud(n){

VueJs 2 click doesn't seem to work

Dylan Glockler I'm not getting any errors and it's compiling so I'm not sure what I'm doing wrong. I searched for this topic without success. I have BulkExpenses.vue which pulls and displays some expense records, then BulkExpenses.vue is a nested component tha

Array delete doesn't work on click listener?

Memet I have an add and eject button on my app . In the add function, I can add items to the array, but when I press the eject button to take items out of the array, it doesn't work. I do not know why it has to be like this. Below my current code: Here is my a

JQuery click() event listener doesn't work

it consolidates I'm trying to get a small project going, but I'm stuck at a very annoying thing. $(document).ready(function() { $("#search-button").click(console.log('hello')) }); As you can see, I'm targeting a search button using the id, and search-buttona

Array delete doesn't work on click listener?

Memet I have an add and eject button on my app . In the add function, I can add items to the array, but when I press the eject button to take items out of the array, it doesn't work. I do not know why it has to be like this. Below my current code: Here is my a

Click listener button doesn't work in Bootstrap

Matt I want to run some javascript code before showing the modal window, but when I click the button, nothing happens and the browser console doesn't give me any errors. jsfiddle <a href="#addEdgeModalB" class="btn"> EDGE </a> <div id="addEdgeModal" class

Array delete doesn't work on click listener?

Memet I have an add and eject button on my app . In the add function, I can add items to the array, but when I press the eject button to take items out of the array, it doesn't work. I do not know why it has to be like this. Below my current code: Here is my a

Array delete doesn't work on click listener?

Memet I have an add and eject button on my app . In the add function, I can add items to the array, but when I press the eject button to take items out of the array, it doesn't work. I do not know why it has to be like this. Below my current code: Here is my a

Click listener button doesn't work in Bootstrap

Matt I want to run some javascript code before showing the modal window, but when I click the button, nothing happens and the browser console doesn't give me any errors. jsfiddle <a href="#addEdgeModalB" class="btn"> EDGE </a> <div id="addEdgeModal" class

Google Map Event Listener doesn't seem to work

Sudar Sun I've used the places map to search for a location, and when the user clicks a marker, I've created a listener to zoom the map, but it doesn't seem to work. I tried <script> function initialize() { var markers = []; var map = new goog

Google Map Event Listener doesn't seem to work

Sudar Sun I'm using the places map to search for a location, and when the user clicks a marker, I've created a listener to zoom the map, but it doesn't seem to work. I tried <script> function initialize() { var markers = []; var map = new goog

Google Map Event Listener doesn't seem to work

Sudar Sun I'm using the places map to search for a location, and when the user clicks a marker, I've created a listener to zoom the map, but it doesn't seem to work. I tried <script> function initialize() { var markers = []; var map = new goog

Xbee API - Packet listener doesn't seem to work

Michal B I have a class that is trying to read packets from other Xbees connected to an Arduino board. Here is the class: public class XbeeReceiver2 { private XBee xbee; private int[] payloadToSend; private int[] payloadReceived; private Queue

Xbee API - Packet listener doesn't seem to work

Michal B I have a class that is trying to read packets from other Xbees connected to an Arduino board. Here is the class: public class XbeeReceiver2 { private XBee xbee; private int[] payloadToSend; private int[] payloadReceived; private Queue

Google Map Event Listener doesn't seem to work

Sudar Sun I'm using the places map to search for a location, and when the user clicks on a marker, I've created a listener to zoom the map, but it doesn't seem to work. I tried <script> function initialize() { var markers = []; var map = new g

Multiscroll JS doesn't seem to work

Lodunoujaisl I want to apply mutliscroll effect to my web page, so I wrote the following code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Split Screen</title> <style> ... </style> </head>

select js autocomplete doesn't seem to work

asanatos See the following example fiddle : Although I can select options from the dropdown menu, typing doesn't autocomplete. I hope when you enter B or A, you should get banana, apple recommendation. I should only be asked to add my item in the list if it do

Multiscroll JS doesn't seem to work

Lodunoujaisl I want to apply mutliscroll effect to my web page, so I wrote the following code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Split Screen</title> <style> ... </style> </head>

Sticky.js doesn't seem to work

muffin I'm currently trying to get sticky.js to work on my webpage...on the navbar - unfortunately it doesn't work! I've tried two different plugins, but neither seem to work! For those who don't know, the idea behind the plugin is that it should "stuck" a cer

Multiscroll JS doesn't seem to work

Lodunoujaisl I want to apply mutliscroll effect to my web page, so I wrote the following code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Split Screen</title> <style> ... </style> </head>

Multiscroll JS doesn't seem to work

Lodunoujaisl I want to apply mutliscroll effect to my web page, so I wrote the following code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Split Screen</title> <style> ... </style> </head>