Alpha Video Training
Results 1 to 3 of 3

Thread: why can i not execute a javascript function in onRenderComplete event of dialog?

  1. #1
    Member cptutrecht's Avatar
    Real Name
    Ger Kurvers
    Join Date
    Feb 2010
    Location
    Netherlands, Utrecht
    Posts
    525

    Default why can i not execute a javascript function in onRenderComplete event of dialog?

    I'm experimenting with the powersearch FP for embedded grid in dialog. Pretty straight forward like in the video's for it: FP11_POWERSEARCH1

    I set default values for some of the search controles and accordingly to the fields which are used by the dosearch button in the examples.

    Of course i want the dialog after initializion start respecting those default values.

    I know i can do that with setting an extra userfilter in the embedded grid. But that seems to be double work (and worse: more difficult to maintain the code)

    So i tried to put the put the doSearch(); calling the javascript function in the onrendercomplete event of the the dialog and would expect that it clicked the dosearch button magically, eliminating the need to set an extra user defined filter for the embedded grid.

    Nothing of the kind, it only throws a javascript error complaining that the embedded grid is not defined.....

    Any idea's why?
    Ger Kurvers
    Alpha Anywhere / V4.5.5.0- Build 5667
    Development: Mysql, windows 10 64 Applicationserver: standard on Windows server 2012 R2

  2. #2
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default Re: why can i not execute a javascript function in onRenderComplete event of dialog?

    My best guess here is that the embedded grid hasn't been created yet. I know. Not helpful. But I'm trying to do the same thing.

    ---
    Sarah

  3. #3
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default Re: why can i not execute a javascript function in onRenderComplete event of dialog?

    Sooooo. Obviously, you can't get there from here calling doSearch() (or whatever) because the embedded grid object doesn't exist yet --- hasn't been created. A check for if (typeof {dialog.EmbeddedGrid_[GridAlias]} != 'undefined') before you call your searching javascript should prevent the error from occurring. Unfortunately, that just means your code won't execute.

    Have you attempted something in the onDialogInitialize event by grabbing the values from your controls & setting the embedded grid's User Filter that way? I was doing something similar --- except with page variables. I ended up having to put code in both the grid & dialog to get everything setup --- mostly because I couldn't figure out how to set the User Filter in the onDialogInitialize event. If anyone knows how to roll this all into one event instead of spreading it across two components, that'd be super duper helpful.

Similar Threads

  1. Wait dialog for Script to execute series of oiperations
    By JetLi in forum Alpha Five Version 11 - Desktop Applications
    Replies: 13
    Last Post: 03-25-2012, 06:08 AM
  2. How to pass a variable to and execute a function
    By OOsorio in forum Alpha Five Version 8
    Replies: 2
    Last Post: 04-05-2011, 11:33 PM
  3. JavaScript onchange event
    By joellustigman in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 11-04-2010, 10:28 AM
  4. Action JavaScript not available in Grid Javascript function declarations
    By Clipper87 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 09-23-2010, 11:22 AM
  5. JavaScript from xbasic event
    By frankbicknell in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 04-29-2010, 11:28 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
  •