cs 단에서는
this
.UltraWebGrid1.Columns.FromKey("CategoryID").Width = Unit.Pixel(15);
그리드의 넓이를 지정하는 방법은
var grid = igtbl_getGridById(gridName); grid.resize(width, height);
이렇게 지정해도 된다.
하지만 자동적으로 column(컬럼)의 넓이가 지정되지 않는다.
WebResizingExtender가 있기는 하지만, 아직 잘 모르겠다.
특정컬럼의 넓이를 지정하는 방법은
igtbl_resizeColumn(gridName, columnId, 500);
이렇게하면된다. coumnId를 알고 잇어야 겠지만~
또 그리드의 넓이를 지정하는 방법은
grid.MainGrid.style.width=intWidth;
이렇게도 가능하다.
방법은 여러가지가 있다
총 컬럼의 넓이를 구해서
var intLength = igtbl_getLength(grid.Bands[0].Columns); //그리드에서 컬럼의 수 for (var i = 0 ; i < intLength ; i++) { // scroll through each column and sum up its width // the + 1 is added to compensate for border widths that may or may not be included in the width intWidth = intWidth + igtbl_getElementById(grid.Bands[0].Columns[i].Id).clientWidth + 1; } // this is a little off due to not compensating for the row selectors, but its close
이렇게 구하면 되겠지
그다음은 적당히 세팅된걸 해상도에 따라 늘리면 되겠지?
포럼에 가니깐 관련문제로 몇자 적은걸 찾았다.
Sorry for this being piecemeal, but as I learn more, it will avoid anyone chasing down the wrong issues. I discovered that the ability to resize the columns as the user was not as non-functional as I thought. The grid comes up displaying the columns all minimum width for the data (despite even setting wider widths on some of the UltraGridColumn definitions.) I cannot seem to resize NAY columns as long as that is the case. But, if I tried enough times, I seem to be able to drag the overall grid width (right end) to the right, making it bigger. When i do so, all the columns seem to resize slightly. After I have done that, I then CAN effect grid size changes by dragging row widths around, but still it doesn;t obey what i do as the user. I drag a column width to the right to make it bigger, and instead the whole grid changes size by the amount I dragged that column edge, and then the columns are all resize fractionally to total the new grid size.
So, summarizing it a different way, as currently set:
1) All columns are coming up minimum width of the data in the rows and none can be resized.
2) After successfully dragging the right edge of the grid to the right (takes several attempts), the columns all resize by a small amount to fit the new overall grid width.
3) After the above, attmpted changes to a column width affects grid width but in such a way that all columns get resized to fill the new overall grid width.
Hopefully it is just some setting I have that is autoresizing all columns instead of obeying the new size of the single column.
내가 생각한 방법이랑 비슷하다.
하지만 문제는 적당히 세팅하여야 하고 해상도 크기를 넘지않게 주의하여야 한다.
누가 코멘트로 고맙다고 자기해결한 걸 요약해 두었네
Ok, I finally figured it out, and hopefully this will be helpful to someone else.
Behavior desired: Default the columns all to specific individual widths to fit wihout horizontal scrollbar while still allowing the user to resize columns individually.
Here are th things that must be set to do this (or at least this works for me now.):
1) DisplayLayout.ColWidthDefault="0px" (Actually, this can be whatever you want the width to be for any column for which you do not specify a width in #4 below).
2) DisplayLayout.AllowColSizingDefault="Free" (so user can manipulate widths)
3) DisplayLayout.TableLayout="Fixed" (also so user can manipulate column widths and not have the columns all resize when you want just one to change)
4) In each UltraGridColumn, set Width="123px" ('123' being whatever you want the column width for that column to be when first displayed.)
After I got the reply saying to do #1, my real problem was most related to #2. Once I got that right, then it obeyed my column widths in UltraGridColumn, though that did require that ALL UltraGridColumns have a Width set, because the default width of 0px causes columns without a width specified to be 0px wide. By using something other than 0px in #1 above, of course, then you can have a minimum width for those columns that you don't want to specify it on.
그냥 free로 다 된다는거 같다.