|
Title: Column size in Datagrid w/ detailView width Post by: rob on February 18, 2014, 07:59:03 AM Hi there,
i've got another problem with column sizing in data grid. What I try to do is have a grid that fills the page (fit: true) and its columns resizing in respect to their content and (in sum) taking up all the width of the grid (fitColumns:true). What I experience is that the columns DO autosize, but if the overall size of the content is to small, the last column does NOT expand to the full width of the grid. This is not a problem in itself, but when I expand the detail content, it only takes up the space up to the right border of the last column (and not, as one would expect, to the full width of the grid). I'm not really sure whats the bug here - either the last column not taking up the whole space or the detail content not taking up the whole space. But in combination its really weird for almost-empty tables but large detail contents. Here's a demo: Code: <html> Title: Re: Column size in Datagrid w/ detailView width Post by: stworthy on February 18, 2014, 08:22:02 PM A column with no 'width' will auto adjust its size to fit column contents and will be invalid for 'fitColumns'. To allow columns take up all the width of datagrid, you must have at least one column set the 'width' property. Please refer to this example http://jsfiddle.net/G4Et2/.
Title: Re: Column size in Datagrid w/ detailView width Post by: rob on February 18, 2014, 11:45:26 PM Hmm, so my first atempt was to just give the last column a width. The problem then is, that a right aligned column looks really weird this way if there's a lot of space (all table content together on the left except for the last column, which is "alone" on the right).
My final solution (a rather hackish one) is to introduce another empty no-titled fillup-column with width:1 which takes up the remaining space. But that looks best for all cases. Edit: for anyone using this approach as well: you have to give the fillup-column a "field" value of a nonexisting field in the data, otherwise the column will not be drawn. Thanks a lot anyway, at least now I understand why :) |