# Tableview columns

**URL:** <https://forum.servoy.com/t/tableview-columns/12300>\
**Category:** Classic Servoy\
**Created:** [June 8, 2010, 9:26am UTC](https://forum.servoy.com/t/tableview-columns/12300 "2010-06-08T09:26:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [June 8, 2010, 9:26am UTC](https://forum.servoy.com/t/tableview-columns/12300/1 "2010-06-08T09:26:57Z")

</div>

Hi,

I have tableview forms where some of the tableview forms do not have column header labels (so the labels are generated by Servoy on runtime) and some of the tableview forms do have header labels on design time (that is needed in case you have a label with display tags %%…%% on your tableview form; you can’t set the titleText for labels)

I would like to have both labels having the same look and feel (both in webclient and in smartclient)

How can I succeed to have header labels that are on my tableview forms exactly the same so that a user doesn’t see any difference if a headerlabel was generated my Servoy or programmed by developer.

I guess I need some style for those headerlabels, but I can’t get it exacty the same as the Servoy generated headers.

Anyone knows how to realize that?

Thanks

Martin

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 8, 2010, 9:36am UTC](https://forum.servoy.com/t/tableview-columns/12300/2 "2010-06-08T09:36:52Z")

</div>

martin,

we have done this very closely, with the solutionModel & creating labelFor on the fly for every field in the body of a table-view[attachment=0]Schermafbeelding 2010-06-08 om 11.31.51.png[/attachment]  
(Thanks to Marc Boegem, for helping us. ![:wink:]( "Wink") )  
So this works in smart-client between every different OS & Look & Feel  
but the gradient (which is html) does not work in webclient! ![:-(]( "Sad")  
we have filed a case for this, so I hope this will be fixed.

If you don’t use gradient (so don’t use html) in the labeFor) than the smart client & webclient are pretty the same!  
the only problem there is, that the height of the labelFor is not respected in the web, but this is fixed for future release.

I will file the whole script (it’s just one global method, that does this automaticly when you login) as a tip on [http://www.servoycamp.com](http://www.servoycamp.com) soon.

 ![Schermafbeelding 2010-06-08 om 11.31.51.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/6/657ef7b7511cc9e4f97168481e2037832b03d2da.png)

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [June 8, 2010, 9:42am UTC](https://forum.servoy.com/t/tableview-columns/12300/3 "2010-06-08T09:42:14Z")

</div>

We just create headerlabels for ALL tableview columns at startup using the solutionModel.  
This is done for over 800 forms and it’s barely noticeable.

I can only think of advantage (at least for our solution)

- never bother about creating labels by hand
- if you change an elementname you can’t forget to change the elementname in the label’s labelFor property
- if you decide to change look & feel, just have to do it in 1 place.

Example can be something like Harjo posted. Look & feel is the thing you decide yourself

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [June 8, 2010, 1:03pm UTC](https://forum.servoy.com/t/tableview-columns/12300/4 "2010-06-08T13:03:37Z")

</div>

Hi Marc, Harjo,

I understand how you can do this with the solutionmodel.  
While reading the fields in tableview using the SM, you can create labels and fill the text property of the label with the titleText property of the field.  
But in case you have a label in the tableview, you can’t use the text property of the label. So where do you put put the “titelText” property of the label?

A while ago I already posted a request for this option (case #259909), but unfortunately, this request has not been handeled (yet)

Martin

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [June 8, 2010, 1:17pm UTC](https://forum.servoy.com/t/tableview-columns/12300/5 "2010-06-08T13:17:22Z")

</div>

> martinh:  
> But in case you have a label in the tableview, you can’t use the text property of the label. So where do you put put the “titelText” property of the label?

As you will use these custom labels (having a labelFor property) on top of your existing elements, just take care of the elements having the textproperty entered correctly.  
This case you can just read this property and use that text for the label.

---

<div class="post-metadata">

**Author:** ![maria](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@maria](https://forum.servoy.com/u/maria)\
**Post date:** [December 2, 2011, 7:16am UTC](https://forum.servoy.com/t/tableview-columns/12300/6 "2011-12-02T07:16:32Z")

</div>

Hi All!

If I use an image on my label in the header together with the mediaOptions set to ‘enalrge’ it doesn’t seem to work.  
The image is a gradient colour picture that I would like to stretch.

Here’s my code:

```auto
var newLabel = solutionModel.getForm(formName).newLabel(titleText, x, 0, columnWidth, 30); 
newLabel.labelFor = fieldName;
newLabel.imageMedia = solutionModel.getMedia("grid_top_middle.png");
newLabel.mediaOptions = SM_MEDIAOPTION.ENLARGE;

```

Would there be any other way to display gradient color in the table header?

Cheers,  
Maria

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [December 2, 2011, 9:02am UTC](https://forum.servoy.com/t/tableview-columns/12300/7 "2011-12-02T09:02:26Z")

</div>

Hi Maria,

to have it working cross-platform, create a html-table and use the image as bg-image.  
I’d say: test it first without solutionModel, than convert it into code…

---

<div class="post-metadata">

**Author:** ![maria](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@maria](https://forum.servoy.com/u/maria)\
**Post date:** [December 4, 2011, 11:51pm UTC](https://forum.servoy.com/t/tableview-columns/12300/8 "2011-12-04T23:51:39Z")

</div>

> mboegem:  
> Hi Maria,
> 
> to have it working cross-platform, create a html-table and use the image as bg-image.  
> I’d say: test it first without solutionModel, than convert it into code…

Thanks Marc.  
I’ll give it a go.

Cheers,  
Maria
