Alpha Video Training
Results 1 to 6 of 6

Thread: Show/Hide Expression & Prerendering

  1. #1
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Show/Hide Expression & Prerendering

    Web app running 5667.

    I'm using client-side show/hide expressions to show or hide various controls. When opening a prerendered UX the controls that should be hidden are very briefly shown to the user. Maybe 1/4 second. Then they disappear. If I turn prerender off and reload that same component it loads with the controls already hidden from view.

    Anyone else experience this? How do you deal with it? Do you just live with it?

    I'm trying to determine if this is a bug within Alpha or if I need to change how I'm showing/hiding controls. Briefly, I get the user's security group in an argument. I evaluate that argument in a JS function. Then return true/false. Sample code below...

    onDialogInitialize Server-side event
    Code:
    dim p as p
    dim pUser as p
    dim sGroups as c = ""
    
    'Setup arguments
    a5ws_logged_in_user_values(pUser)
    sGroups = a5ws_get_user_assignments(pUser.userId)
    
    if is_one_of("Staff",sGroups) then
    	e.arguments[e.arguments.ArgumentNumber("ISSTAFF")].data = "True"
    end if

    JS Function
    Code:
    function isStaff(){
    	var _arg = {dialog.object}.argumentValue('ISSTAFF');
    	
    	if(_arg == 'True'){
    		return true;
    	} else {
    		return false;
    	}
    }
    Ashampoo_Snap_Tuesday, October 15, 2019_12h32m54s_001_.png

    My hunch is I need to come up with a more efficient method. Suggestions/comments welcome as always.

    Thank you.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

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

    Default Re: Show/Hide Expression & Prerendering

    Maybe not more efficient, but rather how to get around what and when Alpha is doing stuff. It takes time for Alpha to figure out what it needs to do... particularly when dealing with a pre-rendered component.

    Instead of hiding the the control, if needed, show the control if needed. That way it will be hidden by default and only shown if all is ok.

    In your Client-side event onInitializeComplete add...

    Code:
    {dialog.object}.setControlDisplay('BUTTON_3',false);
    This should hide your control right away... the user shouldn't get a glimpse of it.

    Now your arguments, functions, pre-rendered stuff has the time it needs to decide whether to hide or show the control.

  3. #3
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Re: Show/Hide Expression & Prerendering

    That's a good idea. It never occurred to me to show a control when needed as opposed to hide.

    Thanks David!
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

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

    Default Re: Show/Hide Expression & Prerendering

    Yeah... the timing with Alpha is a bit of a crap shoot. You never really know what's going to fire when... until you go through it for a specific case.

    Although there is a "Hide" property, you cannot show that field using .setControlDisplay()... which is too bad.

  5. #5
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,458

    Default Re: Show/Hide Expression & Prerendering

    David,
    I am confused about your statement:
    you cannot show that field using .setControlDisplay()... which is too bad.
    I just created a UX with three components:
    a sample text field, labeled 'sampleTextField'
    a "hide" button with: {Dialog.object}.setControlDisplay('sampleTextField',false);
    a "show" button with: {Dialog.object}.setControlDisplay('sampleTextField',true);

    The buttons work as expected. When the button is hidden with the "hide" button, it can then be shown with the "show" button.

    Am I misunderstanding you?

    Jay
    Jay Talbott
    Lexington, KY


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

    Default Re: Show/Hide Expression & Prerendering

    Yes... let me expand my statement...

    Although there is a "Hide" property for a control... if you use that Hide property to hide a control... you cannot then show that control using .setControlDisplay().

Similar Threads

  1. Show/Hide Expression
    By CharlesParker in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 11-11-2013, 09:45 PM
  2. Show/Hide Expression
    By CharlesParker in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 09-18-2013, 05:58 AM
  3. client side show/hide expression to show object when row is dirty
    By Selwyn Rabins in forum Application Server Version 10 - Web/Browser Applications
    Replies: 3
    Last Post: 10-22-2012, 01:41 PM
  4. Hide Help Icon when expression is entered in show/hide property.
    By leetv in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 05-31-2011, 01:26 PM
  5. Show/hide Row Expression
    By ADREYES in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 09-29-2010, 11:47 AM

Bookmarks

Posting Permissions

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