locked
I have a single row table to display in my HTML LightSwitch application. How can I have it automatically selected for the user when navigated to? RRS feed

  • Question

  • My table only has a single record. When the user browses to the screen, I would like to have it selected automatically (programmatically). Any ideas?
    Tuesday, March 18, 2014 11:43 AM

Answers

  • Here is a sample of code from one of our screens to select a default item from the collection's rowtemplate postRender event:

    myapp.UIActivityGroupsListDetails.RowTemplate_postRender = function (element, contentItem) {
        // Select first item
        if (!contentItem.screen.UIActivityGroups.selectedItem)
            contentItem.screen.UIActivityGroups.selectedItem = contentItem.screen.UIActivityGroups.data[0];
    };
    

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Thursday, March 27, 2014 11:13 AM
    • Marked as answer by Angie Xu Friday, March 28, 2014 1:36 AM
    Thursday, March 27, 2014 11:13 AM

All replies

  • Hi batpox

    Thanks for your feedback.

    According to your description above,  you want to select one single column automatically when navigate to it.

    I was thinking this issue for long time, why you want to that. Generally we can display column content about seleted column in same screen, I think this logic will be available for you.

    Moreover, you could also consider submit this issue to LightSwitch Uservoice and vote it, I think Microsoft VS team will take this into consideration soon.

    Best regards

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 25, 2014 9:07 AM
  • Selecting the first row is easy. However, you need to let us know which Visual Studio version and which type of LightSwitch client.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Tuesday, March 25, 2014 9:23 AM
  • Here is a sample of code from one of our screens to select a default item from the collection's rowtemplate postRender event:

    myapp.UIActivityGroupsListDetails.RowTemplate_postRender = function (element, contentItem) {
        // Select first item
        if (!contentItem.screen.UIActivityGroups.selectedItem)
            contentItem.screen.UIActivityGroups.selectedItem = contentItem.screen.UIActivityGroups.data[0];
    };
    

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Thursday, March 27, 2014 11:13 AM
    • Marked as answer by Angie Xu Friday, March 28, 2014 1:36 AM
    Thursday, March 27, 2014 11:13 AM