Table View - Enable/Disable per row

Questions and answers for designing and implementing forms in Servoy

Table View - Enable/Disable per row

Postby patrick1569617634 » Tue Jun 09, 2020 1:54 am

So I have a table that I'm displaying in a form Table View (Locked), where the button does some action

|ID|Status|Button|
|1|Good|Button|
|2|Great|Button|
|3|Bad|Button|

Basically, what I want is to disable the button on each row if the status === 'Bad'
But setting the enabled property of the button sets it for all the buttons on the list.

Is there an easy solution I'm missing?

Thanks!
patrick1569617634
 
Posts: 6
Joined: Fri Sep 27, 2019 10:53 pm

Re: Table View - Enable/Disable per row

Postby swingman » Wed Jun 10, 2020 7:56 am

HI,

Not sure which Servoy you are using and what client you are deploying.
In NGClient, if you are using a table-component or any other component where the columns have a StyleClassDataProvider, you can do the following:

1. Create an unstored calculation in your table which returns a style-name when status == 'Bad'. A calculation like

if(status == 'Bad') return 'bad-status';

2. In your CSS, add something like

.svy-button .bad-status { display: none; }

3. select your calculated field as StyleClassDataProvider.

Hope this helps,
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1336
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: Table View - Enable/Disable per row

Postby patrick1569617634 » Wed Jun 10, 2020 9:56 pm

Christian,

Thanks, that helped!
patrick1569617634
 
Posts: 6
Joined: Fri Sep 27, 2019 10:53 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 5 guests

cron