Assigning widths in View

Posted by DanBoultinghouse on 23-Jul-2015 09:17

I assigned a pixel width to each column in a view. After doing so the 'action' fields are crazy wide. I cannot find a way to control this.

What am I doing wrong.  Thanks.

All Replies

Posted by Orchid Corpin on 23-Jul-2015 11:14

Hi DanBoultinghouse,

Can you post your code on how you implement it?

Regards,

Orchid

Posted by DanBoultinghouse on 23-Jul-2015 11:25

Edited the post - added another image.  Thanks for your help.

Posted by Orchid Corpin on 23-Jul-2015 11:29

In the view width, can you make it "70" only, without the "pixe".

Regards,

Orchid

Posted by DanBoultinghouse on 23-Jul-2015 11:41

Ok.  Changed several field with values - removed 'pix' - no change in View.

Posted by Orchid Corpin on 23-Jul-2015 11:44

can you try to do inspect element in chrome (F12 > console tab) if there are any errors found within the page.

Posted by DanBoultinghouse on 23-Jul-2015 14:11

No errors.  But I think I get now.  Thanks for F12 - I left aligned last column and made wider - actions get squeezed to a more normal width.  I have more columns to add.  Seems once you begin to adjust the column widths; the Action fields take over what is left?  So you kill the ability of the View to auto-adjust?  Anyway back on track.  Thanks Orchid.

Posted by Orchid Corpin on 23-Jul-2015 17:50

You're welcome. Alright, so I assumed you are good to go.

Just drop a comment if you still have any issue related to this.

Regards,

Orchid

Posted by Santosh Patel on 24-Jul-2015 00:23

Given the table is declared to be wide (100% width), any cells without a declared width will consume the leftover space equally. It is possible to apply limited width to the actions and checkbox columns via CSS but as you are giving every field a width, for a table with all fixed width columns, if the sum total of all widths is less than the table's width, left over width is divided equally among all columns. If however, there is a single non-fixed width column, it will take up all the leftover space. This is really a limitation on the browsers and table's layout structure.

table-layout: fixed

can come to the rescue but with that the table as a whole needs to have a fixed width in pixels.

Workaround 1:

- Create a formula field with display label "." (dot character) with return content as "" (empty)

- Add this field as last column to the view

- Add following javascript to the page to set fixed width on the 1st two columns

var actionCol = $('[id^=ld_] table th.actionCol');
actionCol.css('width', '70px');
if (actionCol.index() == 1) {
     actionCol.prev().css('width', '70px');
}


OR

You could wait for the 4.0 release that is coming out soon which uses Kendo UI Grid that offers comprehensive capabilities to size columns as you wish.

This thread is closed