Page 1 of 1

Grid, Expand to Layout column sizing

Posted: Fri May 05, 2017 10:19 am
by jwurst
Is there any way to design a subfile grid so that when expands horizontally then only the right most column expands while the others remain fixed size?

I have my grid in a simple layout set to 100% width. When I expand the browser window then all of the columns resize proportionally but I only want the one column to grow. I tried using javascript to dynamically reset all of the column widths based on the with of the window or layout but it has no effect. Maybe I just don't know how to change a property that is an array?

In screen load:

Code: Select all

function setSFLSize() {
  var puiw = document.getElementById("pui").offsetWidth;
  var calcColWidth= puiw-917;
  applyProperty('MyGridName','column widths', '22,27,141,54,97,55,53,54,54,53,54,55,39,38,42,42,' + calcColWidth);
}
setSFLSize();
window.onresize = function () {
  setSFLSize();
}

Re: Grid, Expand to Layout column sizing

Posted: Fri May 05, 2017 6:10 pm
by Scott Klement
If you're using the "expand to layout" option, it will automatically adjust all of the column widths proportionately to the change in the parent layout size. This is the only feature we have for allowing the grid widget to change in size.

What most customers do is create a grid with only one column, and let that expand to the layout. They will put multiple widgets inside the single column -- so the application can show lots of different things in the grid (not just one field) but since there's only one column in the grid, it resizes nicely.

I suppose you could try to write your own code to resize the columns instead of using the "expand to layout" capability. This is something I have not tried to do -- so I cannot tell you how well it works. Your code looks like what I would try -- except that after changing the column widths property, you'll also have to force it to re-render (i.e. draw) the grid. We provide a grid.render() API that may work, but again, I haven't tried it.

Re: Grid, Expand to Layout column sizing

Posted: Tue May 09, 2017 8:53 am
by jwurst
Thanks for the response. On my attempts, including using grid.render(), I got the grid to partially expand. Some of the displayed elements moved and some didn't so it didn't really work. Using a single column is a good idea and will probably work most of the time.