1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    18
    Vote Rating
    0
    tljuenem is on a distinguished road

      0  

    Default Detect when a Splitter is moved

    Detect when a Splitter is moved


    I am attempting to call a function when I detect that a splitter has been moved. I have several text fields with splitters between them, so it looks like this:

    Attachment 45138

    (Ext.resizer.Splitter) http://docs.sencha.com/extjs/4.0.7/#...sizer.Splitter allows it to be dragged left or right. How do I detect when a splitter is moved so that I can fire off a function when one has been moved I have tried attaching listeners to the splitter with no luck. Thanks in advance!

    Code:
    {
         xtype: 'splitter',
         collapsible: false,
         id: 'tranSplitter1',
         listeners: {
               'change': function(e){
                      console.log("change took place"); //never gets called
               },
               'move': function(e){
                      console.log("move took place for " + e.id); //gets called multiple times, when I’m not moving the splitter and when I’m not
                      console.log(e.getPosition());
               },
               'activate': function(e){
                      console.log("activate took place"); //never gets called
               },
               'resize': function(e){
                      console.log("resize took place"); //never gets called
               }
         }
    },
    

  2. #2
    Sencha - Ext JS Dev Team Phil Guerrant's Avatar
    Join Date
    May 2011
    Location
    Colorado
    Posts
    336
    Vote Rating
    93
    Phil Guerrant is a glorious beacon of light Phil Guerrant is a glorious beacon of light Phil Guerrant is a glorious beacon of light Phil Guerrant is a glorious beacon of light Phil Guerrant is a glorious beacon of light

      2  

    Default


    Splitters don't fire any special events. Your best bet is to listen for the "resize" event of a panel adjacent to the splitter in question.
    Phil Guerrant
    Ext JS - Development Team

  3. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    18
    Vote Rating
    0
    tljuenem is on a distinguished road

      0  

    Default


    Thank you for your reply. That's too bad that splitter moves aren't really detectable. I might just listen for a resize of the textfields on either side of the splitter in question.

  4. #4
    Sencha User
    Join Date
    May 2013
    Posts
    3
    Vote Rating
    1
    yuval.gilboa is on a distinguished road

      0  

    Default


    use 'dragend' event. E.g.,

    splitter.on('dragend', function() {...});