Adding buttons to every row of a table in Responsive.

Forum to discuss the new web client version of Servoy.

Adding buttons to every row of a table in Responsive.

Postby Thomas.shuttleworth » Tue Jun 06, 2017 3:35 pm

Hi,

I've been working with the Responsive layout with a table (Servoy Extra Component) as the main bulk of the form. I was hoping to add buttons to each row of the table which would each open up a window displaying more information.

I've looked at putting some HTML into a Calculation and having the column get it's data from there, but this just printed the HTML as a string.

I would appreciate any help on the matter, thanks, Thomas.
Thomas.shuttleworth
 
Posts: 24
Joined: Wed Apr 05, 2017 5:08 pm

Re: Adding buttons to every row of a table in Responsive.

Postby sean » Tue Jun 06, 2017 5:19 pm

Hi Thomas

The table component in the servoy-extra repository doesn't support additional markup.
Moreover, this component is meant for fast, read-only basic grid display.

You could do this in a regular table-view form.

But I wonder if you have tried some CSS on the column ? (see attached image)

Something like:
Code: Select all
.table-button > div
{
   text-align: center;
   width: 80%;
   height: 25px;
   border-radius: 4px;
   background-color: #0080ff;
   color: #fff;
   cursor: pointer;
}
.table-button > div:HOVER
{
   border-radius: 4px;
   background-color: #66b3ff;
   color: #fff;
}


Then set your column styleClass or styleClassDataProvider property to table-button
You do not have the required permissions to view the files attached to this post.
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Adding buttons to every row of a table in Responsive.

Postby Thomas.shuttleworth » Tue Jun 06, 2017 5:28 pm

Hi Sean,

Thanks for your help, I've tried what you suggested and it worked great!

I used some CSS and set the styleClassDataProvider property to the CSS which gave me the buttons I wanted.

Thanks again, Thomas.
Thomas.shuttleworth
 
Posts: 24
Joined: Wed Apr 05, 2017 5:08 pm

Re: Adding buttons to every row of a table in Responsive.

Postby ProRM » Wed Jun 07, 2017 5:48 pm

Hi Thomas,

How do you set the styleClassDataProvider property to the CSS? I am using a form variable with the value table-button and is not working.
User avatar
ProRM
 
Posts: 107
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Adding buttons to every row of a table in Responsive.

Postby sean » Wed Jun 07, 2017 6:04 pm

Hi Juan,

The most effective way to use the styleClassDataProvider may be to bind with a calculation.
Because then you really get a different value for potentially every record in the table.

If you are bound to a form variable, it won't change per record.
In this case, you might as well just use the static property 'styleClass'
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Adding buttons to every row of a table in Responsive.

Postby ProRM » Wed Jun 07, 2017 7:26 pm

Hi Sean,

The point is that I´ve tried to use the css you sent with a ServoyExtra Table column and it does not work. I tried with the StyleClass for the column and did not work and to use it with StyleClassDataprovider I used a form variable with the value table-button but did not work.
User avatar
ProRM
 
Posts: 107
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Adding buttons to every row of a table in Responsive.

Postby ProRM » Wed Jun 07, 2017 7:40 pm

Sean,

It seems there is some problem with css. now I used a simple color attribute and worked fine. I will now work on defining the button.

Thank you!
User avatar
ProRM
 
Posts: 107
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Adding buttons to every row of a table in Responsive.

Postby sean » Wed Jun 07, 2017 7:41 pm

Hi Juan,

What problem happens? You see no style change ?...or it doesn't look right?

Can you confirm that the same CSS file is working on other elements ?
(i.e. it is not a problem that the stylesheet is not connected)

Also what happens when you inspect in browser (chrome) ?
What do you see for the cell ? Do you have any errors in the browser console ?
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Adding buttons to every row of a table in Responsive.

Postby sean » Wed Jun 07, 2017 7:42 pm

ah we posted at the same time - I missed your second reply :-D
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Adding buttons to every row of a table in Responsive.

Postby ProRM » Wed Jun 07, 2017 8:04 pm

Interesting. The problem was I just copied your css definition into my css file, and the editor did not recognized the properties inside the definition (shown in black). I finally found that editing them and removing the trailing spaces solve the problem (shown in purple into the editor).

I really enjoy learning something new every day :)
User avatar
ProRM
 
Posts: 107
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 8 guests