Default text-alignment for server-side numbers (integer, decimal, price)

LG12
Kilo Explorer

Hi,

My question is: how do I enforce all the int/decimal in ServiceNow server-side tables and fields to align left?

I noticed all the input fields of type number (int, decimal…) in ServiceNow server-sides are aligned to the right, while the text fields are aligned to the left.

When inspecting the page, the Variables table cells had a class-name of “vt”, while the Configuration fields were of class “decimal form-control”.

The cells under Order were of class “vt” and had their style specifically set to “text-align: right”, while the cells under Question, Field and Type did not have their style specified:

 find_real_file.png

find_real_file.png

 

 

 

The “decimal form-control” class was only for decimal numbers, and not for other input types:

 find_real_file.png

find_real_file.png

 

Could you please help me to find out me where “vt” elements get their styling from, and how I can enforce all the numbers of both classes to align to the left?

Many thanks!

1 ACCEPTED SOLUTION

AbhishekGardade
Giga Sage

Hello LG,

I have same requirement but for another table: Check out the below screenshots,

1. right click between column, click on configure ALL.

find_real_file.png

2.  Go to Styles and click on new as below:

find_real_file.png

3. Create new style as below:

find_real_file.png

Please mark answer as Correct if you found it as helpful.

Thanks,

Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

6 REPLIES 6

AbhishekGardade
Giga Sage

Hello LG,

I have same requirement but for another table: Check out the below screenshots,

1. right click between column, click on configure ALL.

find_real_file.png

2.  Go to Styles and click on new as below:

find_real_file.png

3. Create new style as below:

find_real_file.png

Please mark answer as Correct if you found it as helpful.

Thanks,

Abhishek Gardade

Thank you,
Abhishek Gardade

Hi Abhishek Gardade,

 

Thank you for the detailed answer.

 

That doesn't really solve the problem as there are many tables and fields and I don't want to change them one-by-one.

I am looking for a way to make it the default behaviour and imeddiately inherited to all number types such as String type default style is left-alignment.

 

Hi LG,

As far as I know, I think the only option to change the styling is as suggested by Abhishek.

As you can see, in list layout, all the cells have the class as "vt", and the styling is added as an attribute to the cell. So, we can't override that using any CSS, as we won't be finding any specific CSS selectors for integers. The HTML is rendered with that styling using ServiceNow's internal processing logic, and I guess it is not configurable. 

Thanks,

Manish

Hello LG,

for which tables and table fields you want to make such configurations?

You can write a Fix script or scheduled job to create new styles for specific fields and then update the alignment values for fields,

I recommend you to run this script per table. 

Please mark answer as Correct if you found it as helpful.

Thanks,

Abhishek

Thank you,
Abhishek Gardade