Opened 9 years ago

Closed 8 years ago

#11381 closed defect (invalid)

Setting with new grid structure with percentage widths does not render property

Reported by: cerelisa Owned by: Bryan Forbes
Priority: high Milestone: 1.7
Component: DojoX Grid Version: 1.4.1
Keywords: Grid setStructure() Cc:
Blocked By: Blocking:


When using a DataGrid?, I initially set the structure to a default layout until the table column model can be retrieved from the server. I then call setStructure() to set the new table header layout. If the new structure uses percentages as the value of the column width, then the table headers are not rendered correctly. The initial column is not rendered.

I'm attaching a sample test case to illustrate the problem. Note that the grid structure is initially set to "initLayout" which only has 1 column. After grid.startup() is called, grid.setStructure() is called with the new layout. The table new structure should have 4 columns, but only 3 columns are rendered.

Note that if you change the column widths to pixels, then all 4 columns are rendered.

Attachments (2)

test_grid_programmatic_ccb.html (2.5 KB) - added by cerelisa 9 years ago.
Test case to illustrate setStructure() bug
test_grid_programmatic_multiview_width_issue.html (1.4 KB) - added by evan 9 years ago.
A simper test case to reproduce it

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by cerelisa

Test case to illustrate setStructure() bug

comment:1 Changed 9 years ago by evan

This issue should be described as "1st column is not rendered in multiple view mode when column widths are in % form.

Uploading a simper test case to reproduce it.

Changed 9 years ago by evan

A simper test case to reproduce it

comment:2 Changed 8 years ago by bill

Owner: changed from bryanforbes to Bryan Forbes

comment:3 Changed 8 years ago by evan

This issue still exists, but there is a workaround(below) to (only) fix similar issue occurs in test_grid_programmatic_ccb.html. Still not a complete solution since it doesn't help on issues in test_grid_programmatic_multiview_width_issue.html.

var fixView = function(v){
    v.getContentWidth = function(){
        return Math.max(0, Math.max(dojo._getContentBox(v.domNode).w,
               v.getColumnsWidth()) - v.getScrollbarWidth()) + 'px';

var grid = new dojox.grid.DataGrid({...}, div);

dojo.forEach(grid.views.views, fixView);
dojo.connect(grid.views, 'addView', fixView);

//or we can also do further setStructure()

comment:4 Changed 8 years ago by evan

Milestone: tbd1.7
Resolution: invalid
Status: newclosed

Has taken a close look at this, it's actually caused by an inappropriate usage - explicit view width are required when laying out Grid in percentages, also added this info to campus doc

Note: See TracTickets for help on using tickets.