# Change column width of Table in Perspective

**URL:** <https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 31, 2019, 8:49pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059 "2019-07-31T20:49:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [July 31, 2019, 8:49pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/1 "2019-07-31T20:49:06Z")

</div>

Hello,

Can someone help me find where to change the column width using Perspective Table? I have 3 columns and I want to change the size of each. Also, where do I change the Date format for one of the columns?

Thanks,

David

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 31, 2019, 9:50pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/2 "2019-07-31T21:50:44Z")

</div>

To allow for a column to have its size specified, there are several conditions which must be met.

1. You must have an entry in the `props.columns` array.
2. One of the `props.columns` entries MUST have the field specified as a case-sensitive match to a key of your data (using the example data of the Table you could supply “city”, “country” or “population”).
3. Supply a value for `props.columns[x].width`, where “x” is the index of the column specified to be the column for your field/key. The value you specify here is understood to be in pixels, so a value of `150` would mean “150px”. Supplying “px” as part of the value will result in it being ignored.

This screenshot displays how I’ve created a column entry, set my column entry’s field to “city” (which matches a key from my supplied data), and I’ve specified a width of `50`. You can see that my “city” column is considerably thinner than my other columns. Any column which does NOT have a width set will stretch to fill the available area.

 ![19%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0f5760e65743897d957fc9ccb91512ca8920e70e.png)

If you want the column to always be EXACTLY some width, you should set the `props.columns[x].strictWidth` property to be `true`

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 31, 2019, 10:00pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/4 "2019-07-31T22:00:39Z")

</div>

The DateFormat is ALSO set in the column object. You’re looking for `props.columns[x].dateFormat`.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 1, 2019, 1:38pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/5 "2019-08-01T13:38:28Z")

</div>

Thanks for the quick reply! The column width worked perfectly. The date format does not. Please look at my screenshot and see if you can tell what I am missing.

Thanks!

 ![DateFormat](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/38703bab9bd8677c8faa30ca2dafdd8e0bfbd4f5.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 1, 2019, 2:01pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/6 "2019-08-01T14:01:08Z")

</div>

What you’re seeing could possibly be due to a known bug surrounding unix timestamps.

What version are you using? The bug was supposedly fixed for 8.0.3 so if you’re using something older, then this has probably been fixed. If you’re using 8.0.3RC2 or the nightlies and you’re seeing this, then  
something else is going on.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 1, 2019, 2:33pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/7 "2019-08-01T14:33:22Z")

</div>

Version 8.0.2. Please see attached.

 ![VersionAsOf_01Aug2019](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/103edc19a974c70e777da3963661cd59a834b2f6.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 1, 2019, 3:01pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/8 "2019-08-01T15:01:27Z")

</div>

Right, so there’s a really good chance that what you’re seeing has already been fixed in the upcoming 8.0.3 release.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 1, 2019, 3:12pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/9 "2019-08-01T15:12:46Z")

</div>

Ok, I will deal with the current date time for now. Thanks again for the quick responses.

David

---

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [February 25, 2021, 12:07pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/10 "2021-02-25T12:07:55Z")

</div>

Dear cmallonee,  
I don’t know what do not change the width.  
Can you help me?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/3/a33708ae026b48642b8710b2c3366499a82fd199.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 3:36pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/11 "2021-02-25T15:36:26Z")

</div>

Remove the “px” from “50px”.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 18, 2022, 5:24pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/12 "2022-04-18T17:24:11Z")

</div>

Can you explain why you can’t use px? I would default to adding the units as well 🤔

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 18, 2022, 6:19pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/13 "2022-04-18T18:19:51Z")

</div>

Dev is looking into the exact reason, but I think it’s because that width is used as the basis for the “column” inside of the flex row. Supplying a value of “50px” ends up getting used as a basis of “50pxpx” because I think we’re blindly concatenating our own “px” onto whatever is supplied. Just a theory for now - but I wouldn’t be surprised if that’s the actual reason.

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [February 12, 2024, 7:14pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/14 "2024-02-12T19:14:37Z")

</div>

My table doesn't have a columns property and I tried the scrip and it didn't work.  
I am using perspective, I have one column that stores the path to assets, and as you can imagine the path of a directory can be very long and the whiteSpace:nowarp doesn't help all too much because I can't resize my columns width.

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [February 12, 2024, 7:16pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/15 "2024-02-12T19:16:59Z")

</div>

My apologies, I found it... 🥲

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [February 12, 2024, 7:29pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/16 "2024-02-12T19:29:47Z")

</div>

Ok, I edited the properties in the property window and I placed a startup scrip that would set the width and strictwidth to true and nothing seems to happen. I've tried different values as well.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 12, 2024, 7:39pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/17 "2024-02-12T19:39:40Z")

</div>

> [@Miguel\_Villasenor\_Es](#):
>
> I placed a startup scrip that would set the width and strictwidth to true and nothing seems to happen.

Why not just set the properties without the script?

On a related note, anytime anyone claims they set something via a script and experienced no result or change in behavior, I have to immediately assume their script failed silently. Please check your Gateway logs to see if the script is perhaps failing to take any action. Make sure you have saved your changes as well.

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [February 13, 2024, 1:46pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/18 "2024-02-13T13:46:38Z")

</div>

Right, I should have at least posted my script.  
Here is what I have and it doesn't seem to work. Column "Val3" is the one I'm trying to edit, as you can see some of the string from column "val3" makes it's way into column "val4"

The width value is in column number 4 of the table properties. I also added the whiteSpace: nowrap property to the style.

 ![properties](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/7/67f8d3dffadfb1c6ab0b91517cbae8c9c6965e54.png)  
 ![table](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/a/9ac1ce4b2ea75ad7530e55cbb5f47cd75387bbe5.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 13, 2024, 1:52pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/19 "2024-02-13T13:52:49Z")

</div>

You haven't specified the `columns.4.field` property. This (and all the other columns) should have the name of the database column in that field for other properties to take effect.

This is explained in post #2 of this thread. [Change column width of Table in Perspective - #2 by cmallonee](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/2).

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [February 13, 2024, 2:06pm UTC](https://forum.inductiveautomation.com/t/change-column-width-of-table-in-perspective/27059/20 "2024-02-13T14:06:54Z")

</div>

Thank you so much! I didn't realize that each column needed a field property. Aslo.... Those column names are what is in our DB... 😅
