What is the best to build a virtualized table with dynamic row heights (based on content)? - react-table

Trying to build a virtualized table with dynamic row heights based on the content within them. The only thing I have seen somewhat useful is passing a rowHeight to the <VariableList/> component, but would have to know the height in the beginning. Is the only way to do this measuring each inner container using refs? Not sure if that would even work.

Try to do so with react-virtual that will be easy to integrate and customize.

Related

Take up full available width?

I know you can set the data-width. But, how would I go about making it taking up the full available width of the div? I am using Vue and tried to create some methods that would update the width from a variable but for some reason that didn't work and that is a complex solution for something that seems like a simple problem.

In Flex, for manually resizing datagrid, how can I keep the column widths reasonable?

Whenever you resize a datagrid by hand (not via code), the last column seems to retain most of the width. What's worse, whenever you extend it and shrink it to a large degree, the other columns can get smushed. Here's a perfect example:
The ideal solution would distribute width equally or in proportion to the length of the text. In addition, if would avoid covering text when it's not necessary. Now, setting the width to 0.5 in the example above does seem to alleviate the issue, but not prevent it entirely.
What I'd also like to know if there are any well polished, custom datagrids out there that solve this. From trying to find a solution, I suspect the only solutions available are more ad-hoc.
I know two ways to avoid this problem.
1) Use List with special item renderer, which simulates columns (say HBox separated with rules), and header, which repeats the layout of item renderer. It's not very elegant solutions, but the resize is quite predictable. Also you can easily add sorting feature (by adding buttons to header), but I'm not sure if column resize is possible to implement here.
2) Use spark s:DataGrid from SDK 4.x. It hasn't got such resize problems AFAIK.

CSS Table Columns not lining up

I have the following Table example here: http://jsfiddle.net/Lu9y3/
Which is based on the Telerik example here: http://demos.telerik.com/aspnet-mvc/Grid/Paging?theme=vista which is a UI component I am using in an app I am building.
As you can see they use two separate tables to achieve the fixed header and scrollable content. BUT the headers and columns in both tables still line up correctly.
Even if I REMOVE the style from the <col> in the Telerik examples using Web Inspector the columns will still line up... And they are NOT using jQuery to adjust the width. So how come they have their columns lining up and mine do not?
How are they doing this?
The reason you are having issues is because you are using two separate tables. Tables adjust column width to the longest unbroken content. The way Telerik does it, they have four columns and have set the widths explicitly in all but the third column. This allows the third column to expand and fill the remaining space.
Using table-layout:fixed will help but it will make all your columns evenly spaced regardless of content. I recommend setting the width of each column, or better yet make a class for each width and reuse that on the appropriate columns.
Lined up sample
I don't use classes in my example but I think you get the idea. I used overflow:hidden on th and td to make sure that longer content doesn't display over the other cells of the table. I also think the visual effect of the table works better with fewer columns seven or eight columns might be a bit overkill, but that's my personal opinion.
Using table-layout: fixed; makes the table line up ;)
I'm using Google Chrome, and when I open up the editor (F12) to Telerik's site and change the settings, they start not lining up. I've done some research, and according to W3.org on <col>, it looks like there is no way to globally name a <col> that you can use in multiple talbes (sadly).
Also, in Telerik's example, it appears that the <col> definitions specify a width in the tag itself (likely manually placed via some JS). I think this is the only way to do it other than setting specific CSS rules, but that may not work as well as a more dynamic solution.
Best of luck!

Flex: six seconds between initialize and creationComplete

I'm working with a large flex applications and I have noticed that one of our largest components (with lots of child canvases) takes about 6 seconds between the initialize and creationComplete events. I've been doing some reading and have found that having lots of nested canvases can cause slowdowns, but i'm not sure if this is where the slowdowns would be? Anyone have any suggestions on speeding this up, or even diagnosing exactly where the slowdowns are coming from?
It's been my experience that nested containers with dynamic sizing are the most common cause of these types of lags. Some things to try:
Set explicit sizes/positions for your containers/components whenever possible. This reduces the incredible amount of measuring that goes on within the framework during the creation process.
Reduce the number of nested containers. Sounds obvious, but it's amazing how much you can cut away when you start looking critically at how your UI is set up. Specifically, are there HBox and VBox containers you can get rid of by simply setting explicit positions/sizes for the child components? Do you really need to use a Form container?
Switch your containers to the much lighter weight Spark Groups instead of using the heavier weight Canvas where possible.
Hope that helps. If not, post some code so we can dig in to your particular issue.
The biggest thing to consider is to use VBox's and/or HBox's in place of some dynamically generated x's and y's. VBox and HBox are much more efficient. Look into it!
Adding many display objects to the display list all at once can take a long time, especially if we're talking about Flex containers that have layout and scrolling logic in the mix. Since you say you're using many Canvas containers, that could certainly be the issue you're running into.
I know that a lot of developers abuse the creationPolicy property. Normally, it is set to "auto" which allows Flex to defer instantiation of a container's children until a very short time "later". Often, before the next frame, so you don't even see the difference. Do you happen to set creationPolicy to "all" anywhere in that hierarchy? This could be forcing the Canvases and their children to be created immediately.

Qt: Align controls that are in separate layouts

On a form designed with Qt Designer, I have two QGroupBoxes with a bunch of controls in each of them. Both group boxes have nearly the same contents (QLineEdits with associated labels).
What I want to do, however, is to align the controls together, as if they were part of the same grid layout. But since they are in separate containers, they can't share the same layout, and I don't want to give them a fixed width.
Is there a way to do it in Qt Designer? If not, is there a way to do it in code?
Thanks!
There is no way to do this in Designer. As far as I know, Qt does not provide a good way to do this in code either. If you really want this, you will probably have to rely on something a little hacky.
Here's my first idea: Override resizeEvent() in the widget that contains the two group boxes to get the preferred size (via sizeHint() or minimumSizeHint()) of all of the labels and set the fixed width of all the labels to the largest preferred width.
I would encourage you to ask yourself if this really matters (is it worth the development time?) and consider whether you can avoid the problem entirely with a slightly different UI design.
BTW, you might want to take a look at QFormLayout if you haven't already.

Resources