Hybrid View

  1. #1
    Sencha User jinionnet's Avatar
    Join Date
    Apr 2012
    Location
    Cochin
    Posts
    42
    Vote Rating
    0
    jinionnet is on a distinguished road

      0  

    Default How to add a click event in controller for Action Column Item using Architect?

    How to add a click event in controller for Action Column Item using Architect?


    Hi guys,
    I have an action column item and I want create a click event in my controller. I know there is a handler event in the action column itself. But I really need to reference in my controller file. I can't find any id/itemid property for action column item. So how how can a refer this element in the controller.

    Please help me. here is my code

    Code:
    .........some other grid items ..........
         {
                xtype: 'actioncolumn',
                id: 'acViewCashDetails',
                width: 50,
                align: 'center',
                items: [{
                getClass: function(v, metadata, r, rowIndex, colIndex, store) {
                             if(r.get('referral_count')>0){
                                     this.items[0].tooltip='Click to view the details.';
                                     return 'view';    
                                   }else{
                                        return '';
                                    }
                            },
                                handler: function(view, rowIndex, colIndex, item, e) {
                                    //some codes here. then it will work but, i already have a function in controller
                                   // and I really want to use that function or just want create another in controller
                                }
                            }
                        ]
                    }
    
    ........some other grid items .......

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    350
    Vote Rating
    1
    bharatn is on a distinguished road

      1  

    Default


    You can use xtypes in your control query similar to this

    http://docs.sencha.com/ext-js/4-0/#!...ComponentQuery
    Bharat Nagwani
    Sencha Designer Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2007
    Posts
    8
    Vote Rating
    0
    thermiteplasma is on a distinguished road

      0  

    Default


    I couldn't find a click event for an actioncolumn as well, so i just fired a custom event from the handler, then listened from the controller

  4. #4
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,329
    Vote Rating
    212
    ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold

      0  

    Default


    Quote Originally Posted by thermiteplasma View Post
    I couldn't find a click event for an actioncolumn as well, so i just fired a custom event from the handler, then listened from the controller
    I did the same.
    The worst part was that the documentation (ExtJS) is not helpful. I have to look at the framework code and the old trial & error methodology.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  5. #5
    Sencha User jinionnet's Avatar
    Join Date
    Apr 2012
    Location
    Cochin
    Posts
    42
    Vote Rating
    0
    jinionnet is on a distinguished road

      0  

    Default


    Quote Originally Posted by bharatn View Post
    You can use xtypes in your control query similar to this

    http://docs.sencha.com/ext-js/4-0/#!...ComponentQuery
    actioncolumn xtype not pick up the event in controller.

    Thanks

  6. #6
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,329
    Vote Rating
    212
    ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold

      0  

    Default


    Quote Originally Posted by jinionnet View Post
    actioncolumn xtype not pick up the event in controller.
    Action column never invokes fireEvent. Thats why, as you and I did, we have to invoke fireEvent in the handler.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  7. #7
    Sencha User jinionnet's Avatar
    Join Date
    Apr 2012
    Location
    Cochin
    Posts
    42
    Vote Rating
    0
    jinionnet is on a distinguished road

      0  

    Default


    Hi,
    Do you have any idea to invoke a function from the "handler"? Of course the function should be defined in the "Controller" !

    Thanks,
    Jineesh

  8. #8
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,329
    Vote Rating
    212
    ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold

      4  

    Default


    Quote Originally Posted by jinionnet View Post
    Hi,
    Do you have any idea to invoke a function from the "handler"? Of course the function should be defined in the "Controller" !
    I though you already figured out.

    1. Define the custom event in the gridpanel:

    ext1.png

    2. Fire the event in the handler. Note that you must fire the event from the grid to capture in the controller. I tried to capture the gridview event (query: "grid gridview") but didn't worked.

    ext2.jpg

    3. Add the controller action:

    ext3.jpg

    I wish we could be able to extend column as another components but you cant drop column in views node.

    Hope this helps.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!