locked
LightSwitch HTML - Catch event after showScreen() RRS feed

  • Question

  • Hi!

    I'm filtering grid items via

    myapp.showLeistungserfassungList(screen.EmployeeId, searchMonth, searchYear, searchProject, searchCategory);

    After filtered data is retrieved I would need to make some calculations (client computed query).

    Is there a way to catch event when ajax call is over? Or is there another solution for it?

    btw. I tried

     myapp.showLeistungserfassungList(screen.EmployeeId, searchMonth, searchYear, searchProject, searchCategory, {
            beforeShown: function () {
                alert('beforeShown');
            },
            afterClosed: function () {
                alert('afterClosed');
            }
        });

    but those event's are never triggered.

    Ty

    Friday, May 10, 2013 6:31 AM

Answers

  • Looks like I was filtering my data wrong. I was calling method for showing screen I was on. I changed it to corresponding get method. After it, I'm calling 2nd method that is retrieving calculated data from WCF. Data is retrieved but not showed, old data remain in "text elements" (labels). Should I change data in those "labels" manually or there is a way to do it automatically? If I need to do it manually what's the best way to do it? Can I catch event when AJAX call is finished?

    Thank you!

    This may help:

    Retrieving The Current User In The LightSwitch HTML Client

    If makes an Ajax call, calls a method when it is done, then changes the underlying value that caues the label to update.


    The Visual Studio LightSwitch Marketplace

    http://LightSwitchHelpWebsite.com


    • Edited by ADefwebserver Monday, May 13, 2013 12:06 PM
    • Marked as answer by Zorčec Friday, May 17, 2013 10:35 AM
    Monday, May 13, 2013 12:05 PM

All replies

  • You may have the problem I ran into last night. I was following my own example at:

    Visual Studio LightSwitch Screen Navigation and Advanced JavaScript Examples

    In my case, when I typed in the "show" method:

    myapp.showLeistungserfassungList(

    I saw that because I did not have an entity on the screen, only a collection based on a query,  the signature was not:

       myapp.showLeistungserfassungList(null, {
            beforeShown: function (addEditScreen) {
    
            },
            afterClosed: function (addEditScreen, navigationAction) {
    
            }
        });
    

    but instead:

       myapp.showLeistungserfassungList({
            beforeShown: function (addEditScreen) {
    
            },
            afterClosed: function (addEditScreen, navigationAction) {
    
            }
        });
    

    I updated the article to add:

    Note: With the “show” method, be aware that depending on the particular page, the method may take different parameters than the ones in this example. You can us intellisense to determine what parameters the method expects


    The Visual Studio LightSwitch Marketplace

    http://LightSwitchHelpWebsite.com

    Friday, May 10, 2013 1:11 PM
  • Looks like I was filtering my data wrong. I was calling method for showing screen I was on. I changed it to corresponding get method. After it, I'm calling 2nd method that is retrieving calculated data from WCF. Data is retrieved but not showed, old data remain in "text elements" (labels). Should I change data in those "labels" manually or there is a way to do it automatically? If I need to do it manually what's the best way to do it? Can I catch event when AJAX call is finished?

    Thank you!

    Monday, May 13, 2013 8:42 AM
  • Looks like I was filtering my data wrong. I was calling method for showing screen I was on. I changed it to corresponding get method. After it, I'm calling 2nd method that is retrieving calculated data from WCF. Data is retrieved but not showed, old data remain in "text elements" (labels). Should I change data in those "labels" manually or there is a way to do it automatically? If I need to do it manually what's the best way to do it? Can I catch event when AJAX call is finished?

    Thank you!

    This may help:

    Retrieving The Current User In The LightSwitch HTML Client

    If makes an Ajax call, calls a method when it is done, then changes the underlying value that caues the label to update.


    The Visual Studio LightSwitch Marketplace

    http://LightSwitchHelpWebsite.com


    • Edited by ADefwebserver Monday, May 13, 2013 12:06 PM
    • Marked as answer by Zorčec Friday, May 17, 2013 10:35 AM
    Monday, May 13, 2013 12:05 PM
  • Thank you! Very useful example!
    Friday, May 17, 2013 10:37 AM