Alpha Video Training
Results 1 to 9 of 9

Thread: What Javascript Event Fires Every Time A UX Is Opened From A List?

  1. #1
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,618

    Default What Javascript Event Fires Every Time A UX Is Opened From A List?

    I have a list which opens a data-bound UX component. When the UX component opens, I check the value of a checkbox. Then I set another field based on the state of the checkbox.
    The code I have is this:

    Code:
    var checked = {dialog.Object}.getValue('SERVICE_STATE');
       if (checked){
    	{dialog.object}.setValue('STATE','FAIL');
       }
       else {
    	{dialog.object}.setValue('STATE','PASS');
       }
    This works fine but only the first time I open the UX component. If I close the component then open it again, or open a different record, it does not fire.

    I've had this in the Client-Side Javascript events OnRenderComplete and OnDialogInitialize but it only fires the first time I open the UX. I can't seem to find an event that works every time.
    What am I missing?
    Alpha Anywhere v12.4.6.1.2 Build 6012-5338 IIS v8.5 on Windows Server 2012 in Hyper-V

  2. #2
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    in version 11 dialog, there is an event onDiaglogExecute that fires all the time, do they have it version 12 or moved it out?
    if they have it, will that work in this scenario?
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

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

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Are you running an Action Javascript to open the UX? If so, do you have "Use cached UX Component" turned on? If so, have a look at the in-line help for this property. If turned on, onDialogInitialize will only fire once, because a cached version is used. If turned off onDialogInitialize will fire each time the UX is opened.

    Remember that onDialogInitialize is a server-side event.

    As well, onRenderComplete and onInitializeComplete both fire all the time if caching is turned off. However, onInitializeComplete won't give you what you want because the data isn't there yet. onRenderComplete will.

    If you want to use Caching... then have a look at the Client-side event afterPopulateFromTable. This fires every time, even with caching turned on.
    Last edited by Davidk; 02-14-2017 at 02:53 PM.

  4. #4
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,618

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Quote Originally Posted by Davidk View Post
    Are you running an Action Javascript to open the UX? If so, do you have "Use cached UX Component" turned on? If so, have a look at the in-line help for this property. If turned on, onDialogInitialize will only fire once, because a cached version is used. If turned off onDialogInitialize will fire each time the UX is opened.
    Ahh, yes that was it David. I had 'use cached' turned on. Turned it off and now it works!
    Thanks, I've been scratching my head all afternoon on this
    Alpha Anywhere v12.4.6.1.2 Build 6012-5338 IIS v8.5 on Windows Server 2012 in Hyper-V

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

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    I added additional info to a previous post so just to make sure I'll repeat it here. I knew there was an event that worked with Caching... but wasn't sure of it's name.

    If you want to use Caching... then have a look at the Client-side event afterPopulateFromTable. This fires every time, even with caching turned on.

  6. #6
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,618

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Quote Originally Posted by Davidk View Post
    I added additional info to a previous post so just to make sure I'll repeat it here. I knew there was an event that worked with Caching... but wasn't sure of it's name.

    If you want to use Caching... then have a look at the Client-side event afterPopulateFromTable. This fires every time, even with caching turned on.
    Excellent! Thanks for that info.
    Alpha Anywhere v12.4.6.1.2 Build 6012-5338 IIS v8.5 on Windows Server 2012 in Hyper-V

  7. #7
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,091

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Yes, this is excellent INFO for sure. I set my MAIN session var "session.coid" in server-side "onDialogInitialize" and this is a SQL lookup to get the company_id so if I turn on pre-render and have use a local namespace for storage (persist and restore) and create a static HTML page with an application cache - are you saying that there is a chance that the session var set MAY NOT be set on re-loading the component?
    Or am I missing the point?
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  8. #8
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    425

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Quote Originally Posted by iRadiate View Post
    I have a list which opens a data-bound UX component. When the UX component opens, I check the value of a checkbox. Then I set another field based on the state of the checkbox.
    The code I have is this:

    Code:
    var checked = {dialog.Object}.getValue('SERVICE_STATE');
       if (checked){
    	{dialog.object}.setValue('STATE','FAIL');
       }
       else {
    	{dialog.object}.setValue('STATE','PASS');
       }
    This works fine but only the first time I open the UX component. If I close the component then open it again, or open a different record, it does not fire.

    I've had this in the Client-Side Javascript events OnRenderComplete and OnDialogInitialize but it only fires the first time I open the UX. I can't seem to find an event that works every time.
    What am I missing?
    onDialogInitialize (which is a server-side event) fires the first time the UX is opened.

    If caching is enabled, onSynchronizeDialog will fire on subsequent opens. The server-side equivalent event is onSynchronize.
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

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

    Default Re: What Javascript Event Fires Every Time A UX Is Opened From A List?

    Interesting... thanks Sarah. I had to read that a couple of times to understand it. onSynchronizeDialog does not fire the first time the UX is instantiated. It only fires if the UX has already been instantiated. It's an interesting event because you get 2 pararmeters... the Javascript object... and synchronizeType. In my tests I see that synchronizeType can be "editListRow"... but could detail what other values this parameter might be? Thanks

Similar Threads

  1. Replies: 3
    Last Post: 04-03-2015, 10:13 AM
  2. javascript help for onPullRelease event handler for list control in mob panel
    By brad.lindsay69@gmail.com in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 08-27-2014, 02:56 PM
  3. Event fires and doesn't set field focus
    By JBrown in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 05-26-2011, 02:20 PM
  4. Why inline-javascript code fires before ajax callback UDF xbasic code?
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 6
    Last Post: 10-29-2010, 07:46 AM
  5. Bug or quirk? OnArrive field event fires with toolbar save button.
    By Mike Wilson in forum Alpha Five Version 10 - Desktop Applications
    Replies: 16
    Last Post: 08-19-2010, 11:58 PM

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
  •