Results 1 to 2 of 2

Thread: I need to assign same listeners to all grid of my project

  1. #1
    Sencha User
    Join Date
    May 2015
    Posts
    41
    Vote Rating
    0
      0  

    Default I need to assign same listeners to all grid of my project

    Hi
    I have a series of grids defined in this way:

    PHP Code:
    Ext.define('CS.view.GareList' ,{
        
    extend'Ext.grid.Panel',
        
    alias'widget.garelist',
    .... 





    I need to assign to all of them the "select" and "deselect" listeners. For obvious reasons, i want to avoid to explicity declare it on each grid component. I want that this parameter is applied automatically on all of them! Also, i want to avoid to declare it into the controller for a don't lose the self-consistency of the component.
    I thought to two solution:
    1) Define a "generic grid" with my listeners that will be extendend by other grids

    PHP Code:
    Ext.define('CS.view.CustomGrid' ,{
       
    extend'Ext.grid.Panel',
       
    alias'widget.customgrid',
       
    listeners:{
          
    select:function(objrecorditemindexeeOpts ){
               
    //some thing
          
    },
          
    deselect:function(objrecorditemindexeeOpts ){
             
    //some thing
          
    }

      }             
    }) 
    and so

    PHP Code:
    Ext.define('CS.view.GareList' ,{
        
    extend'CS.view.CustomGrid',
        
    alias'widget.garelist',
    .... 


    2) Create a config object that is automatically passed to constructor method of my grids. But in this case i don't know how to do it.

    Which is the correct way to do it?

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Vote Rating
    291
      0  

    Default

    I would extend the grid panel and add your listeners to that class, then use it for all your grids. Basically solution 1 gets my vote.

Similar Threads

  1. How to assign store of a grid to SearchFieled
    By salarmehr in forum Ext: Q&A
    Replies: 2
    Last Post: 26 May 2014, 9:30 PM
  2. how to assign array to grid data.
    By raj_sh in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 4 Feb 2008, 11:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •