SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

DGrid doesn't render nicely inside ContentPane or TitlePane #1274

Closed bartverweire closed 8 years ago

bartverweire commented 8 years ago

Hello,

I'm starting to integrate dgrid into my application, which heavily relies on nested layout elements like LayoutContainers, ContentPanes and TitlePanes. Even in a very simple test case, I can see that dgrid doesn't render nicely inside a ContentPane or TitlePane. This is because the ContentPane by default has a padding, which I would like to keep. In a default ContentPane, the header is left aligned with the border ContentPane, disrespecting the padding. If I modify the css like .dijitContentPane .dgrid-header-row { left: 8px; }

    .play_with_css.dijitContentPane .dgrid-scroller {
        top: 8px;
    }

The header aligns well, but the header columns are slightly smaller than the normal columns.

Uploaded a test html file (as test.txt) with a modified version of the Hello dgrid page.

test.txt

Regards,

Bart

kfranqueiro commented 8 years ago

There are a couple of oddities in your example which I can immediately identify.

  1. You probably want to consider mixing in dgrid's DijitRegistry extension for better compatibility with dijit layout widgets.
  2. Your code is creating dgrid instances that will "clobber" your ContentPanes, replacing their domNode with each grid's own. This becomes more immediately noticeable upon mixing in DijitRegistry since then dijit will complain about duplicate IDs being registered. (When you pass a 2nd argument to a dijit or dgrid constructor, it expects to replace the given node with the widget being constructed, which is different than e.g. typical placeAt usage.)
  3. It's not entirely clear from the reduced example what your ultimate goal is, but dgrid instances using DijitRegistry do not need intermediate ContentPanes in order to be placed within layout containers such as BorderContainer and StackContainer. If you're ultimately looking to place grids in layout containers, you may not need ContentPanes at all.

Given that this is more of a usage question than a dgrid bug, I'm closing this and would suggest posting a question on StackOverflow if you still have questions after trying the advice above. Thanks!