# Disable button in Body part with Table view

**URL:** <https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196>\
**Category:** Classic Servoy\
**Created:** [November 18, 2010, 9:46am UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196 "2010-11-18T09:46:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [November 18, 2010, 9:46am UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/1 "2010-11-18T09:46:04Z")

</div>

Hello,

I have a form with Table view set, and for each row I have a button.

How can I make the button for a specific row to be disable?

For instance, in the image below I want the first button to be disabled because there is no file to be saved.

[attachment=0]table\_button.png[/attachment]

Thanks,  
Bogdan.

 ![table_button.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/1X/59ec4404e9ef4a1eb4cf4be52722daeb87ffa9fb.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:** [November 18, 2010, 10:41am UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/2 "2010-11-18T10:41:10Z")

</div>

don’t think it can be done with a native button.  
Why not use an icon and create a calculation which will show the icon based your criteria?

---

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [March 15, 2011, 6:13pm UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/3 "2011-03-15T18:13:47Z")

</div>

How can I return an icon in a calculated field, so it will show in a TableView form, to indicate a status or something for each row?  
I’m trying to figure this, but don’t have any clue.

---

<div class="post-metadata">

**Author:** ![Roberto\_Blasco](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Roberto\_Blasco](https://forum.servoy.com/u/Roberto_Blasco)\
**Post date:** [March 15, 2011, 6:56pm UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/4 "2011-03-15T18:56:25Z")

</div>

Hi **udrescu\_bogdan**

```auto
return "media:///picture.png";

```

where _picture.png_ is in the media branch of the servoy solution.

Best regards. Roberto Blasco.

---

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [March 16, 2011, 3:30pm UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/5 "2011-03-16T15:30:35Z")

</div>

Hello, thanks for reply, but still doesn’t work for me.

I have this calculation, which I set it first to type TEXT, the I tried with MEDIA. But in both cases the image is not displayed in the TableView field.

```auto
function status_icon() {

	if (status == 1) {
		return "media:///circle_yellow.png";

	} else if (status == 2) {
		return "media:///circle_red.png";
	}

	return "media:///circle_green.png";
}

```

The TableView looks like this:  
[attachment=0]status.PNG[/attachment]

Is there any other setting to do at the label in which I want the image to be displayed? Or anything else?

Thanks,  
Bogdan.

![status.PNG](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/6/6e5bb7bd3fcc64fa625a8a42250c2cfb245d9ba1.png)

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [March 16, 2011, 3:44pm UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/6 "2011-03-16T15:44:03Z")

</div>

Set your field to HTML\_AREA, then return a html with the img embedded:

```auto
function status_icon() {
   var html = '<html><body><img src="';
   if (status == 1) {
      html += "media:///circle_yellow.png";

   } else if (status == 2) {
      html += "media:///circle_red.png";
   } else {
      html += "media:///circle_green.png";
   }
   return html + '"></img></body></html>';
}

```

You might want to add some style as well to place your image correctly inside the field, and make sure that the scrollbars property is set to"V:n H:n".

Hope this helps,

---

<div class="post-metadata">

**Author:** ![victor.rojo](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@victor.rojo](https://forum.servoy.com/u/victor.rojo)\
**Post date:** [March 17, 2011, 7:38am UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/7 "2011-03-17T07:38:04Z")

</div>

> udrescu\_bogdan:  
> Is there any other setting to do at the label in which I want the image to be displayed? Or anything else?

Try setting the calculation as TEXT and a field as IMAGE\_MEDIA instead of the label. This works for me.  
Hope this helps!

---

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [March 25, 2011, 1:09pm UTC](https://forum.servoy.com/t/disable-button-in-body-part-with-table-view/13196/8 "2011-03-25T13:09:06Z")

</div>

Thanks, I didn’t try it till then, but now I got it running.
