-
Notifications
You must be signed in to change notification settings - Fork 324
Fixed Header #4
Comments
+1 |
3 similar comments
+1 |
+1 |
+1 |
So what are people doing now because I needed fixed headers TODAY :) |
+1 column header + row header |
Hi guys, Thanks for votes. I know this is very important for a lot of you but this is actually non-trivial to implement. To implement this, I either have to wait for #5 and #6, or quickly whip up a hack that basically renders 2 tables, one with a header and one without, and layer the one without the header on top but below the header. I'm open to accept patches for any solution to speed this up. |
Thanks for quick response. I was in a rush and ended up wrapping a Marionette.ItemView around the DataTables lib that does exactly that as I am basically trying to replicate a Windows Explorer style list and theirs will do for now. http://www.datatables.net/examples/basic_init/scroll_xy.html You may as well look at their code as it does the job, with a few hacks to update columns after container/window resizing. I don't have time in the short term to port this across to backgrid.
|
+1 |
6 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 for Fixed Header. |
+1 |
Wondering if anyone has any made any improvements on the fixed header issue within the last few months. |
As of today, you can use CSS to target individual columns and turn off the rendering of the default header. To implement a fixed header, you can prepend a separate grid that only shows a list of column headers above the grid container that's wrapping the grid containing all the rows. Again, use CSS to target the columns to have the columns of 2 separate grid line up. A proper fixed header extension will be coming shortly after 0.3.0 has been released. |
+1 |
8 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
I couldn't find someone who solve this problem, so I made a plugin who works with backgrid to manage fixed header. https://github.com/gsantome/backgrid.fixedheader In my project is working GREAT and it's really easy to implement. |
Just an update to issue: You can already achieve this using a pure CSS. http://tjvantoll.com/2012/11/10/creating-cross-browser-scrollable-tbody/ I might just baked this into the default stylesheet. |
+1 |
1 similar comment
+1 |
The pure css solution doesn't resize width very well. |
+1 (might implement myself, but not sure when). Please check the implementation here, for a good way of doing this (eventually). That would be a dream come true (notice how the first column AND the header stays fixed). They are not using |
We can still use table elements, we just have to set |
Y'all should check out Oraculum |
I am still trying to figure out how to make the header fixed :( any example would be helpful. |
Big fan of backgrid! For a quick/dirty fixed header using jquery+css transform, I have found the following functions handy. Note this is not perfect, just a starting point for an alternate solution to those listed above. Thanks for all your hard work wyuenho!
|
@pdg- I added floatThead ( a jquery plugin) for it , i will try your code, thanks for your share . |
I'm using backgrid.paginator, but the following should apply to the regular usage as well. This is what I did to make the header columns align with the body columns: pageableGrid.listenTo(rowCollection, "reset", function () {
pageableGrid.$el.find('tbody tr:first-child td').each(function (index) {
pageableGrid.$el.find('thead th').eq(index).css('width', jQuery(this).width());
});
}); As you see, after paginating the collection or sorting a column, there's a collection reset event which means I might need to realign stuff. |
+1 I tried to implement the CSS solution mentioned above by adding those CSS rules, but my grid simply becomes a very large one column table and it does not fix the header. I also tried using this pageable grid idea just above, but to no avail. floatThead did fix my table headers, but as soon as I scrolled horizontally, the grid lost its integrity and the columns spanned the entire screen and did not keep up with the cells. I tried implementing the overflow scrolling but I must have been missing something there. I'm just looking for something to accomplish this with the backgrid I have. I must be missing something, is there any further examples or alternatives people have? |
floatThead author here. no idea what backgrid is, just browsing related issues. Let me know if I can be of assistance (without installing anything) 🐈 |
@mkoryak I'm using your plugin in production since a couple of months ago and I love it. Thank you from the bottom of my heart. The only improvement I'd dare to ask would be to have floatHead-slim.js wrapped as UMD module instead of relying in the global scope and IIFE. |
PRs are welcome :) |
+1 |
1 similar comment
+1 |
If you are targeting newer browsers you can use:
|
You can already achieve this using a pure CSS.
http://tjvantoll.com/2012/11/10/creating-cross-browser-scrollable-tbody/
A similar approach should probably be baked into the default stylesheet.
The problem is lining up the column widths of the th and tds. This will have to be done together with #5. The JS necessary to calculate a width for each column is trivial. Let me know if you get to it first.
For now, you can give a CSS min-width manually to each column's th and td.
The text was updated successfully, but these errors were encountered: