locked
How to collapse rows in HTML5 Client RRS feed

Answers

  • You look to be using a TileList for the ActionItem collection. Then a rows layout for the row template for Action.

    Because this is a collection you cannot do a 'screen.findContentItem("GroupDate")' as it does not exist. It gets ignored.

    It works ok for me here in a similar scenario and here is some sample code that I have:

    myapp.TestVisibility.RowTemplate_postRender = function(element, contetItem) {
    
    // Switch visibility of group items
    switch (contentItem.data.QuestionType) {
    case "Duration":
        contentItem.findItem("TileGroupDuration").isVisible = true;
        contentItem.findItem("TileGroupYesNo").isVisible = false;
        ...
    case "Other":
        ...
    }
    };

    In your case I think just hiding/showing the group should be sufficient and no need to hide/show the child items in some groups, like 'GroupDate'?

    I have an example here doing all sorts of data driven hide/show so if you have trouble get back with your javascript event code.

    Cheers


    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, February 27, 2014 11:40 AM
    • Marked as answer by Angie Xu Monday, March 3, 2014 1:44 AM
    Thursday, February 27, 2014 11:39 AM

All replies

  • Since I can't reproduce your problem on my side, could you post your code?
    Wednesday, February 26, 2014 9:03 AM
  • Hi

    Thanks for picking up on this one.

    Below is what I see in the Designer but no where do I see where to "set its vertical alignment property to top"

    The last screenshot is what the user sees.

    This is a sample of the code:

                switch (screen.ProjectQuestions.selectedItem.QuestionType) {           
                    
                    case "Duration": 
                        screen.findContentItem("ActionItem_selectedItem_YesNoAnswer").isVisible = false;
                        screen.findContentItem("ActionItem_selectedItem_PhotoAnswer").isVisible = false;
                        screen.findContentItem("ActionItem_selectedItem_DateAnswer").isVisible = false;
                        screen.findContentItem("ActionItem_selectedItem_StartTime").isVisible = true;
                        screen.findContentItem("ActionItem_selectedItem_EndTime").isVisible = true;
                        screen.findContentItem("ActionItem_selectedItem_Duration").isVisible = true;
                        screen.findContentItem("GroupDuration").isVisible = true;
                        screen.findContentItem("GroupYesNo").isVisible = false;
                        screen.findContentItem("GroupDate").isVisible = false;
                        screen.findContentItem("GroupAnswer").isVisible = false;
                        screen.findContentItem("GroupChoice").isVisible = false;
                        screen.findContentItem("GroupCurrency").isVisible = false;
                        break;
    Regards, Mark.


    Mark

    Thursday, February 27, 2014 4:10 AM
  • You look to be using a TileList for the ActionItem collection. Then a rows layout for the row template for Action.

    Because this is a collection you cannot do a 'screen.findContentItem("GroupDate")' as it does not exist. It gets ignored.

    It works ok for me here in a similar scenario and here is some sample code that I have:

    myapp.TestVisibility.RowTemplate_postRender = function(element, contetItem) {
    
    // Switch visibility of group items
    switch (contentItem.data.QuestionType) {
    case "Duration":
        contentItem.findItem("TileGroupDuration").isVisible = true;
        contentItem.findItem("TileGroupYesNo").isVisible = false;
        ...
    case "Other":
        ...
    }
    };

    In your case I think just hiding/showing the group should be sufficient and no need to hide/show the child items in some groups, like 'GroupDate'?

    I have an example here doing all sorts of data driven hide/show so if you have trouble get back with your javascript event code.

    Cheers


    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, February 27, 2014 11:40 AM
    • Marked as answer by Angie Xu Monday, March 3, 2014 1:44 AM
    Thursday, February 27, 2014 11:39 AM