Results 1 to 4 of 4

Thread: I need a help to add event in radiofield

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    78
    Vote Rating
    1
      0  

    Question Answered: I need a help to add event in radiofield

    Hi,

    Anyone help me............. ??

    How to add event on radiobutton in MVC app??
    I want to show hide panel on selectionchange of radio...

    how to add event in controller for radio???

    Help me.........

  2. Hi there. For a start I am really no pro, but hopefully this can help you in the right direction.
    First the Radiofield has the xtype: radiofield. (As seen at the top of the documentation)
    This is important from the controllers perspective to know what to look for.
    Then the events being fired is "check" and "uncheck" as seen in the documentation under Events

    Now we need to go to the controllers init function, here we define what the controller shall control.
    Here we define what to "control", the init function is being fired when the controller is initialized. (unless you load it manually, then you have to run it manually)
    The reason I use "panel > radiofield" below is to show you the "magic", that you can access all radiofields within a panel etc in one line. It works with xtypes, ids, classes.

    "radiofield#viewRadio" only access the radiofield with the id set to viewRadio
    data will be the radiofield instance that has been checked or unchecked
    PHP Code:
    init: function(){
      
    this.control({
         
    'panel > radiofield' : {'uncheck' : function(data){ view.unload();  }},
          
    'radiofield#viewRadio' : {'check' : function(data){ view.load(); }}    
       });    
    }, 
    I hope this helped you to get a understanding of how controllers work in ST2

    Best Regards
    Kasper Pihl
    Denmark

  3. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    78
    Vote Rating
    1
      0  

    Default

    Wow..........
    Nobody Help me

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    16
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Hi there. For a start I am really no pro, but hopefully this can help you in the right direction.
    First the Radiofield has the xtype: radiofield. (As seen at the top of the documentation)
    This is important from the controllers perspective to know what to look for.
    Then the events being fired is "check" and "uncheck" as seen in the documentation under Events

    Now we need to go to the controllers init function, here we define what the controller shall control.
    Here we define what to "control", the init function is being fired when the controller is initialized. (unless you load it manually, then you have to run it manually)
    The reason I use "panel > radiofield" below is to show you the "magic", that you can access all radiofields within a panel etc in one line. It works with xtypes, ids, classes.

    "radiofield#viewRadio" only access the radiofield with the id set to viewRadio
    data will be the radiofield instance that has been checked or unchecked
    PHP Code:
    init: function(){
      
    this.control({
         
    'panel > radiofield' : {'uncheck' : function(data){ view.unload();  }},
          
    'radiofield#viewRadio' : {'check' : function(data){ view.load(); }}    
       });    
    }, 
    I hope this helped you to get a understanding of how controllers work in ST2

    Best Regards
    Kasper Pihl
    Denmark

  5. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    78
    Vote Rating
    1
      0  

    Default

    Thanks.........

    Working

Posting Permissions

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