locked
How to enable/disable button in every row of a table? (HTML Client) RRS feed

  • Question

  • Hi, 

    I'm trying to disable a button in a table wich is in every row, based on user permission. 

    In previous versions I used this code in myapp.ScreenName.created:

     if (myapp.permissions["LightSwitchApplication:CanManageWhatever"]) {
            screen.findContentItem("BtnName").isEnabled = true;
        }
        else {
              screen.findContentItem("BtnName").isEnabled = false;
        }
    with the Hidden if disabled property of the control enabled.

    but in msls-2.5.0/2.5.1 is not working anymore, it only hides the column's header.

    In the Silverlight Client we used findControlInCollection.


    Nicolás Lope de Barrios
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Wednesday, September 17, 2014 3:41 PM

Answers

  • Sorry my mistake.

    put this code into postrender function of the button:

    if (myapp.permissions["LightSwitchApplication:CanManageWhatever"]) { contentItem.isVisible = true; } else { contentItem.isVisible = false;

    }

    Monday, September 22, 2014 4:48 PM

All replies

  • Hi,

    put your code in postrender code of the button in the row.


    Sunday, September 21, 2014 8:56 AM
  • Hi,

    put your code in postrender code of the button in the row.


    Marek, I think in postRender is a little late. It doesn't work. Maybe using jQuery?

    Nicolás Lope de Barrios
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Monday, September 22, 2014 1:36 PM
  • Sorry my mistake.

    put this code into postrender function of the button:

    if (myapp.permissions["LightSwitchApplication:CanManageWhatever"]) { contentItem.isVisible = true; } else { contentItem.isVisible = false;

    }

    Monday, September 22, 2014 4:48 PM