jqgrid automated columns width - jqgrid

I have a table where I show some columns depending on users choice stored in database.
What I want is:
If all columns width is shorter than table width, expand columns to use the entire table width.
If all columns width is longer than table width, make columns narrower so no horizontal scrollbar appears.
If I manually change a column width within the table (using the vertical line next to the column header), I need the other columns to autoresize so the full width is 100% (not longer nor narrower) of table width.
I've been using the parameters autowidth, shrinkToFit and forceFit, but when full width is ok, then if I resize a column manually a horizontal scrollbar appears. I cannot find the correct combination of those parameters so the table behaves like that.
Any idea on how to put those values to get my aim?
Thank you very much-

Related

ShrinkToFit does not expand frozen columns if grid has width to expand

I'm creating a pivot table using jqgrid with group headers. I do some calculation on input data to figure out if combined column width would exceed the fixed width of grid. If it does not exceed then i would change shrinkToFit : truefor grid to occupy full width. If I do it, then dragging column width creates alignment issues between header and body.
Problem gets worse if frozen column are enabled. The fixed header div wont expand like the column underneath it if shrinkToFit is enabled.
Here is a demo to understand the problem : http://codepen.io/anon/pen/NbxWrQ
Any leads will be helpful.
Thanks in advance.

Stacked table column widths

You can use a GeneXus HTML table to layout text blocks and attributes. If I add a second table to contain some other information that I want to conditionally display, quite often, the first cell is a different width to the first cells of the table stacked above it.
How do you make all the columns/cells the same width so that stacked tables display with their contents correctly aligned?
This is for GeneXus Web in Evo 2 & 3.
Thanks
Put a value in the width property of the client table first cell.
So, put the same value in the width property of the password table first cell.
Remember that the width value must be enough for both tables. In your case, the biggest textblock is the "Client Name". So, choose a width enough for that.
Best regards.
If you don't set a width, HTML will assume the minimum width required to accommodate the content. If you don't want it to be set automatically when when the page is displayed, you have to decide on a width.
In your case, you have to put the same width value for a cell (any cell) in the first column of both tables.

NSTableView align resize columns

I need to create a NSTableView with 3 columns and these columns have to fit the space like this form 20% 60% 20%. I set the constraints in the interface builder but no success. The result is always the same. The 3 columns are shown but in the same size as in the IB, and if i resize the window the table resizes too but the columns keep with the original size.
How can i resize the columns proportionally to tableview size?
How can i align one column always to the right?
Need help please. My project is for OS X, not iPhone.
Thanks in advance.
I'm not sure what constraints you tried to set, but table columns are not views, so they don't participate in auto layout.
There's no automatic support for what you're trying to achieve. NSTableView can be set to distribute a change of width equally among its columns (setting columnAutoresizingStyle to NSTableViewUniformColumnAutoresizingStyle), but that doesn't maintain the proportions like you want.
I think you want to set the table view so that it doesn't resize its columns. Then you would monitor it for any changes in its frame and adjust the column widths yourself.
You can set the column autoresizing style of the table view in IB.
To monitor the frame, you can either use a subclass of NSTableView and override -setFrameSize: or you can have some controller observe the NSViewFrameDidChangeNotification notification from the table view. Either way, you'd want to calculate 20% and 60% of the width. You probably want to round or truncate to an integer. Also, you should use percentages only for two of the three columns. For the third, subtract the width you computed for the first two from the table view's width. That's the easiest way to be sure they all add up.
For each column, check if the width you calculated is different from its current width and, if so, set its width.

jqrid column width should be displayed based on the length of the column content

in my jqgrid i have several columns, the first columns length is big, the remaining columns are small. So all the columns are having a big width. I want the column width to be displayed as per the data content of the column. I cannot specify the width in pixels.
I tried using the autowidth propety but it doesnt work for me. Any suggestions please.

How to set optimal width for labels column in jqgrid edit and view forms

jqGrid edit and view forms row labels (they are same as column captions ) are set at runtime.
Sometimes they are narrow and sometimes wide.
For narrow labels column width in too big. There is too much empty place between label text and value field.
It looks like labelswidth: '30%' value is hard coded.
How to adjust edit and view form labels columns width automatically so that if all labels are narrow, column width is smaller ?
The first which I would try to do is to use the values in pixel instead of percents:
labelswidth: 80, width: 600

Resources