locked
Programmatically Change URL in HTML Table Control (Microsoft help) RRS feed

  • Question

  • Hello,

    need to do something really simple.

    I have an HTML Table and when i select a Row i want to redirect to a different screen based on the values in the tables.

    Example Report Screen as a Report Table, First Column is the Report ID second column Report Name

    If Report ID is 1 redirect to a screen.

    If Report ID is 2 redirect to another screen.

    Any idea?

    thank you so much...

    --silvano


    • Edited by silva71 Monday, November 16, 2015 5:36 PM
    Monday, November 16, 2015 7:12 AM

Answers

  • Hi Silvano,

    The bit that you are missing is to implement your own tap event and write a bit of javascript there to show the appropriate screen.

    1. Select the Table in the screen designer
    2. Click the "Item Tap" link and select "Write my own method" from the popup (specify a suitable name for the method/function if you want, although the default should do) and click OK
    3. You will see the new tap function name being added to the list of objects on the left side of the screen designer
    4. Double click the newly added tap function to open the empty method inside the code editor
    5. Implement code similar to the following (change names of visual collection and properties and screens as required):

    myapp.ReportBrowse.Reports_ItemTap_execute = function (screen) {
        var report = screen.Reports.selectedItem;
        if (report.Id === 1) {
            myapp.showReportViewerA(report);
        } else if (report.Id === 2) {
            myapp.showReportViewerB(report);
        });
    };
    

    The above assumes that both ReportViewerA and ReportViewerB screens take a Report entity as a parameter. The screen.Reports.selectedItem property contains the entity selected under the row in the Table that you tap on.

    Hope this helps.


    Regards, Xander. My Blog

    • Proposed as answer by ADefwebserver Wednesday, November 18, 2015 12:29 AM
    • Marked as answer by silva71 Wednesday, November 18, 2015 2:09 PM
    Tuesday, November 17, 2015 8:57 PM

All replies

  • Hi Weiver,

    any help on this please?

    many thanks!

    Monday, November 16, 2015 11:28 AM
  • Please anyone on this?

    thank you so much!

    --silvano

    Tuesday, November 17, 2015 3:44 PM
  • If you have a table on your screen, you can choose what happens when you tap or click it. You can then set which screen is navigated to. See screenshot.

    You can either create the new screen or browse to an existing screen.

    Hope that helps.

    • Marked as answer by silva71 Tuesday, November 17, 2015 4:53 PM
    • Unmarked as answer by silva71 Tuesday, November 17, 2015 4:53 PM
    Tuesday, November 17, 2015 4:38 PM
  • Hi Paul,

    thank for your answer.

    Actually i want to do it dinamycally, for example based on your asset number i want to redirects to a specific screen passing the rigth parameters, so it now just one static screen.

    --silvano

    Tuesday, November 17, 2015 4:55 PM
  • Hi Silvano,

    The bit that you are missing is to implement your own tap event and write a bit of javascript there to show the appropriate screen.

    1. Select the Table in the screen designer
    2. Click the "Item Tap" link and select "Write my own method" from the popup (specify a suitable name for the method/function if you want, although the default should do) and click OK
    3. You will see the new tap function name being added to the list of objects on the left side of the screen designer
    4. Double click the newly added tap function to open the empty method inside the code editor
    5. Implement code similar to the following (change names of visual collection and properties and screens as required):

    myapp.ReportBrowse.Reports_ItemTap_execute = function (screen) {
        var report = screen.Reports.selectedItem;
        if (report.Id === 1) {
            myapp.showReportViewerA(report);
        } else if (report.Id === 2) {
            myapp.showReportViewerB(report);
        });
    };
    

    The above assumes that both ReportViewerA and ReportViewerB screens take a Report entity as a parameter. The screen.Reports.selectedItem property contains the entity selected under the row in the Table that you tap on.

    Hope this helps.


    Regards, Xander. My Blog

    • Proposed as answer by ADefwebserver Wednesday, November 18, 2015 12:29 AM
    • Marked as answer by silva71 Wednesday, November 18, 2015 2:09 PM
    Tuesday, November 17, 2015 8:57 PM
  • Also look at the "showScreen" method on this page: HTML Client API Reference

    Regards, Xander. My Blog

    Tuesday, November 17, 2015 8:59 PM
  • Thank you so much Xander!
    Wednesday, November 18, 2015 2:10 PM