I am dynamically loading data into my ui-grid, so I do not know the number of columns beforehand. My ui-grid is working properly as long as I do not set the minWidth of the column, but as soon as I set the minWidth, the alignment is disturbed. Data from the rows above is being displayed on the rows below. But when I scroll to the right, the data automatically aligns itself.
I have attached images as this is kind of confusing. I have searched a lot, but could not get an answer anywhere.
I'm not sure which version of ui-grid you are using (your styling looks different).
If you are on the current version, you should be able to use the auto-resize option http://ui-grid.info/docs/#/tutorial/213_auto_resizing which will resize the grid when data is first loaded. It will also resize when you resize the browser.
Related
I want to autosize the grid columns to max size of the content. How do i do this. i see only autoSize function on grid column, not sure how to use it.Say column header width is more then the column data width, that should be used.
I have used autosize function, It works, but i have few issues, I have to define the align property i.e text fields will be left and number fields will be on right, then heading text gets cut. I have locked columns in all reports, locked section gives some empty spaces.
https://fiddle.sencha.com/#fiddle/1cr6
See column selling code. Its not showing full because of align: Right property. If you remove it will work.
2.After DOW column empty space is coming.
Without minWidth Property columns wont scale properly.
Take a look at this piece of documentation: Ext.grid.column.Column - Setting sizes. I don't think you can make columns scale to content. You can, however, set fixed sizes or make them flex.
I hope this helps.
I have a grid and I would like to automatically resize the columns. I'm running into inconsistencies when using different parameter values for PerformAutoResize(). When passing in the values below, where the true means include column headers:
PerformAutoResize(PerformAutoSizeType.VisibleRows, true);
some columns will be resized based solely on the header, while others will resize properly based on both the header and the row values.
However, if I hardcode in a value:
PerformAutoResize(20);
It works fine for every column.
Why is this?
UPDATE
Through some trial and error I've come to the conclusion that I think the issue is that I bring in the data and then have it auto-sort by a certain row. When using a hard coded value, it appears to auto-size the columns after that initial auto-sort, whereas when I use PerformAutoSizeType.VisibleRows it appears to auto-size the columns before the initial auto-sort.
Does PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true); give you the results that you are looking for?
If so then is it possible that when you make the call that the row that you want to size the grid by isn't visible?
I need to display data in the UI in a table format. I am using wpf (MVVM), VS 2010 and windows XP. I do not want to use the DataGrid or ListView. How can I achieve this?
What I have tried
Method 1:
I tried to use SharedSizeGroup but that didn't work. The main problem with using SharedSizeGroup is that even the row height is shared among all rows.
Method 2:
I tried to use UniformGrid but I was not completely successful. Using UniformGrid will not suite my application because each column data is of different width and I do not want each column to take the same width as the Max of all!
Can anyone please tell me how to use the normal grid to get the desired result? Is there any way to use SharedSizeGroup so that only the column width is shared but not the row height and each row occupies only desired space (i.e. same behavior as setting the height to auto) but not more than that?
Additional information: This grid has to be read-only and no row should be selectable in the UI.
Please look at the attached screenshots.
I'm adding a datagrid to the rowdetails area for each row in the template.
The problem I have now is that the rowdetails area sizes correctly when it gets larger, ie when more content is added.
But once you collapse those rows(and their corresponding rowdetails) and open another rowdetail that is smaller than the first one, the rowdetails container does not resize back(ie smaller) to fit the smaller content.
Please refer to the following flickr set, as I am not allowed to post images or more than one hyperlink: http://www.flickr.com/photos/47755109#N08/sets/72157623590404492/
How do I fix this issue?
Regards
Renier
I searched the net about this issue, and found only very complicated workarounds (like here).
But it is actually VERY easy to fix that issue:
<sdk:DataGrid.RowDetailsTemplate>
<DataTemplate>
<ContentControl **VerticalAlignment="Top"**
...
--> if the control inside the datatemplate has a verticalalignment of "Top" (vs. the default "Stretch") the rows shrink as expected.
Regards
Johannes
I know that this question is extremely old, but I just stumbled across it after having encountered this problem previously. It is related to other problems like http://forums.silverlight.net/p/96989/279885.aspx
Basically the root is that the DataGrid control wants to avoid having its rows jittering in size. Because of virtualization when you scroll an element off (lets presume horizontal scrolling) the element is no longer rendered. So when Silverlight tries to determine the height of a row if the largest piece of the row is off the side (and therefor virtualized) then it can't really know how tall the row should be without rendering all of the off screen content. So in this case they made a compromise, they use the height of elements that are on the screen or the current height of the row, if the current height is larger than all the elements currently on the screen. This results in the behavior you're describing.
There are a few workarounds, one described in the link above is to turn off virtualization on the DataGrid, but this can have performance impact if there is a non-trivial amount of data in the DataGrid. The other one that I used was to set the DataGrid row height to 0, force a re-render and then set the row height back to its default or auto. This way I was able to force the rows to shrink back down.
Hope that helps someone who stumbles across this problem.
I have a Silverlight datagrid with custom code that allows for +/- buttons on the lefthand side and can display a table with a tree structure. The +/- buttons are bound to a IsExpanded property on my ViewModelRows, as I call them. The visibility of rows is bound to an IsVisible property on the ViewModelRows which is determined based on whether or not all of the parent rows are expanded. Straightforward enough.
This code works fine in that if I scroll up and down the grid with PageUp/PageDown or the arrow keys, all the right rows are hidden and everything has the right structure and I can play with the +/- buttons to my hearts content. However, the vertical scroll bar on the right hand side, although it starts off the correct size and it scrolls through the rows smoothly, when I collapse rows and then re-expand them, doesn't go back to its correct size. The scrollbar can still usually be moved around to scroll through the whole collection, but because it is too big, once the bar moves to the bottom, there are still more rows to go through and it sort of jerkily shoots all the way down to the bottom or sometimes fails to scroll at all. This is pretty hard to describe so I included a screenshot with the black lines drawn on to show the difference in scrollbar length even though the two grids have the same number of rows expanded.
I think this might be a bug related to the way the Datagrid does virtualization of rows. It seems to me like it isn't properly keeping track of how tall each row is supposed to be when expansion states change. Is there a way to programmatically "poke" (read hack) it to recalculate its scrollbar size on LoadingRow or something ugly like that? I'd include a code sample but there's 2 c# files and 1 xaml file so I wanted to see if anyone else has heard of this sort of issue before I try to make it reproducible in a self-contained way. Once again, scrolling with the arrow keys works fine so I'm pretty sure the underlying logic and binding is working, there's just some issue with the row height not being calculated properly.
Since I'm a new user, it won't let me use image tags so here's the link to a picture of the problem:
http://img210.imageshack.us/img210/8760/messedupscrollbars.png
This is a known issue according to what I read today (and is apparently still an issue in the as-yet-unreleased Silverlight 4):
http://forums.silverlight.net/forums/p/153997/343790.aspx