Alpha DevCon 2018
Results 1 to 8 of 8

Thread: Buttonlist Pressed vs disabled CSS

  1. #1
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Buttonlist Pressed vs disabled CSS

    I have buttonlist in a list detail view inside absolute layout container. I have an enable expression on the buttonlist to disable conditionally. Is there a way to visually display which button is pressed while disabled?
    Is there some an order of precedence or hierarchy that can be altered?


    Thanks
    John H

  2. #2
    Member
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    778

    Default Re: Buttonlist Pressed vs disabled CSS

    The A5 JS library code (Ver 12.4.5.1 Build 4642) has no provision for providing another "state" for a buttonList to visually indicate it is "selected" BUT "disabled" at the same time. In the A5 JS library code search for the object assignment "A5.buttonLists = {" In that object, find the function named 'html' and look at the code near the end of it that looks like the following:

    Code:
                    state = '';
                    if (vals.indexOf(bs.value) != -1)
                        state = 'pressed';
                    if (bs.disabled)
                        state = 'disabled';
    Notice how it checks for 'bs.disabled' after checking to see if the button is selected ('pressed') and overwrites the 'state' variable with 'disabled'. There would need to be a fourth state to indicate pressed and disabled. But, the button would also need two more properties, something like: 1) pressedDisabledClassName, and 2) pressedDisabledIcon. There are several places in the library functions that would need changing. Another, option would be to dynamically change the value in the 'disabledClassName' property for each button based upon if the button is selected or not. You could use the default class name when the button is disabled and not selected. But, when the button is disabled AND selected you would have another CSS class to visually indicate the button is selected, but disabled. You would have to put in your own code to switch the class name as needed and to redraw the buttonList when needed. You could also do the same for the 'disabledIcon' property of each button in the buttonlist, if you are using icons.

    An easier solution would be to create a second, simpler, control for displaying the data when the buttonList is supposed to be disabled. Hide the buttonList when you don't want to allow changes and instead show the other, view-only, control. As the value of the buttonList is changed via the 'onClick' event, you would want to keep the other view-only control updated.

  3. #3
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: Buttonlist Pressed vs disabled CSS

    Rich,
    Thank you for the detailed reply. I'm looking into each of your ideas. Forgive me but where would I find the a5 JS Library?
    Thanks John H

  4. #4
    Member
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    778

    Default Re: Buttonlist Pressed vs disabled CSS

    Run your app in Chrome. Press
    Code:
    Ctrl-Shift-i
    to open Chrome's Developer Tools window. On Developer Toosl menu bar, across the top, click "Sources", if it is not already the active window. Below that bar you will get a list of various a5w and js files. Look for a file name that begins with "a5-" and is followed by 8 digit number. That number is made up of the AA Build number you are on plus another four digit number. If you do not see that file name, click the ">>" to the right of file the file names to open a dropdown with all the open a5w and js files. With that file being displayed, click the "{ }" symbols at the bottom left corner of that window to format the js into something readable. Go to the top of that file and type ctrl-f to open the "find" box. Type the following:

    a5.buttonLists =

  5. #5
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,670

    Default Re: Buttonlist Pressed vs disabled CSS

    I do find it interesting, and insightful, to look into Alpha code... but I find you can't base any kind of dependence on it from release to release. The current release section for that code is the following... you can see how's it's changed.

    Code:
                  if (bs.disabled || s.disabled) {
                        if (state == 'selected')
                            state = 'disabled-selected';
                        else
                            state = 'disabled';
                    }
    And then there is other code which applies a disabled selected class... but the end result is the same as other releases. In the end, you don't really know what you're dealing with... or could depend on it for very long before a change might break your code.

    You can do something to supplement whatever it is that Alpha is doing.

    I don't know how this will be affected by your container... you'd have to post a sample to test with. And... you don't mention which version of Alpha you're working with or how your ButtonList Control is being disabled. However, this process works if you know which button in the list has been selected... and how you disabled the Button List.

    Based your ButtonList Client Side Enable expression on a Javascript function. E.g. mine is set to

    Code:
    btnListDisabledCheck(txtDisableButtonList)
    Here I'm calling a function named btnListDisabledCheck and passing in a control I have named txtDisableButtonList.

    The function is...

    Code:
    function btnListDisabledCheck(txtDisableButtonList){
    
    	if(txtDisableButtonList != 0){
    		setTimeout(function(){
    			var btnList = $('{dialog.ComponentName}.V.R1.BTNLISTDISABLED.CONTROL.2');
    			btnList.className += btnList.className ? ' buttonPressed' : 'buttonPressed';
    		},50);
    		return false;
    	}else{
    		return true;
    	}
    
    }
    Just for this test, I'm evaluating the control I passed in... if it's not equal to zero then I want the ButtonList Control disabled... but I am adding the Class Name 'buttonPressed' to whatever Classes are already in the 3rd button.

    Each button in the list has it's own ID... therefore you can get at it.

    You can add whatever Class you want... including any you create yourself... it doesn't have to be Alpha's buttonPressed Class

  6. #6
    Member
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    778

    Default Re: Buttonlist Pressed vs disabled CSS

    David,
    What is the build # for the JS Library you looked at?

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,670

    Default Re: Buttonlist Pressed vs disabled CSS

    It's the current pre-release... 4786_5022

  8. #8
    Member
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    778

    Default Re: Buttonlist Pressed vs disabled CSS

    Hum, so Alpha's working on the ButtonList. That is good news. I see in pre-release 4786, that David mentioned, the ButtonList builder does not yet have a place for recording the CSS class name and icon to be used when the button is pressed (selected) and disabled at the same time. Don't know if they will put those two properties into the builder, though. There are a lot of things (properties and events) that the buttonList has that are not exposed by the builder. I am really hopeful they will expose more of the events. In particular I'd like to see the ButtonList's 'refresh' event exposed with places for us to inject js code before and after that event.

Similar Threads

  1. ButtonList in UX
    By Ken Tjia in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 08-10-2014, 03:28 PM
  2. Replies: 10
    Last Post: 05-08-2014, 04:28 PM
  3. ButtonList problems
    By lvasic in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 04-10-2014, 04:40 PM
  4. which link has been pressed
    By JimDK in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 11-18-2010, 08:33 AM
  5. What happens when CANCEL is pressed?
    By pruel in forum Web Application Server v7
    Replies: 0
    Last Post: 04-25-2006, 02:07 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
  •