1. #1
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default toggle button pressed

    toggle button pressed


    I'm having trouble handling the toggle event of a button.

    This is what I'm trying but it is not working:

    Code:
     toggleHandler: function (btn, pressed) {
            if (pressed) {
            notices.noticeStatusStore.removeAll();
               notices.noticeStatusStore.setBaseParam('showAll', 'no');
               notices.noticeStatusStore.reload();
                         
            } else {
            notices.noticeStatusStore.removeAll();
                notices.noticeStatusStore.setBaseParam('showAll', 'yes');
                
               notices.noticeStatusStore.reload();
            }
        }
    Anyone know what I'm doing wrong?

  2. #2
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    set a debug point inside the handler. Look if notices is known inside the handler.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default


    yeah it works once or rather once the toggle button is pressed my baseParam is always no. even if I toggle the button back to it's original state. the handler fires every time the button is pressed but pressed is always true in the if statement.

  4. #4
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default


    oops ok the handler function is working I am getting true and fale but setBaseParam is not working the second time. showAll remains 'no' when I reload the store.

  5. #5
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default SOLVED kind of

    SOLVED kind of


    It looks like I'm seeing this behaviour because I'm using reload on the store it must be caching the last value. load worked except there were other params that I wanted to retain.

    by doing this:

    Code:
      toggleHandler: function (btn, pressed) {
       
            if (pressed) {
            
            notices.noticeStatusStore.removeAll();
               notices.noticeStatusStore.setBaseParam('showAll', 'no');
                           notices.noticeStatusStore.reload({
            params: {
                start: 0,
                limit: 35
            }
        });
    
                         
            } else {
            notices.noticeStatusStore.removeAll();
              notices.noticeStatusStore.setBaseParam('showAll', 'yes');
                
                notices.noticeStatusStore.reload({
            params: {
                start: 0,
                limit: 35
            }
        });
    
            }
        }
    it fixed my problem and the other params retained there value. that I do not specifically list. so I guess that will work for now. weird.

Similar Threads

  1. [SOLVED] Toggle button's pressed parameter return an object
    By ironlion in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 5 Aug 2010, 9:22 PM
  2. Is there a way to set the pressed property of a button?
    By StevenInc in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 1 Dec 2009, 12:11 PM
  3. Pressed Toggle State in Toolbar Button
    By Domitian in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 16 May 2007, 9:00 PM
  4. Toggle button: change button icon when pressed?
    By dbadke in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 26 Mar 2007, 7:14 AM

Thread Participants: 1

Tags for this Thread