Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10103 closed defect (invalid)

Grid doesn't render inside a Dialog

Reported by: jose.noheda Owned by: Nathan Toone
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.4.0b
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

If no total width is specified the grid does not render properly when a dialog is showed. See:

<html>

<head>

<link href="dojo/resources/dojo.css" rel="stylesheet" /> <link href="dijit/themes/dijit.css" rel="stylesheet" /> <link href="dijit/themes/soria/soria.css" rel="stylesheet" /> <link href="dojox/grid/resources/Grid.css" rel="stylesheet" /> <link href="dojox/grid/resources/soriaGrid.css" rel="stylesheet" /> <script type="text/javascript" src="dojo/dojo.js"

djConfig="parseOnLoad: true"> </script>

<script type="text/javascript">

dojo.require("dijit.Dialog"); dojo.require("dojox.grid.DataGrid?"); dojo.require("dojo.data.ItemFileWriteStore?");

var data = {identifier: 'id', label: 'name', items: [

{ id: 'AF', name:'Africa', type:'continent',

population:'900 million', area: '30,221,532 sq km', timezone: '-1 UTC to +4 UTC', children:[{_reference:'EG'}, {_reference:'KE'}, {_reference:'SD'}] },

{ id: 'EG', name:'Egypt', type:'country' }, { id: 'KE', name:'Kenya', type:'country', children:

{_reference:'Nairobi'} },

{ id: 'Nairobi', name:'Nairobi', type:'city' }, { id: 'SD', name:'Sudan', type:'country', children:

{_reference:'Khartoum'} },

{ id: 'Khartoum', name:'Khartoum', type:'city' }

]};

</script>

</head> <body class="soria">

<div id="dialog" dojoType="dijit.Dialog">

<span dojoType="dojo.data.ItemFileWriteStore?" data="data"

jsId="jsonStore"></span>

<table dojoType="dojox.grid.DataGrid?" autoHeight="true"

rowsPerPage="6" store="jsonStore">

<thead>

<tr>

<th field="id" width="100px">ID</th> <th field="name" width="200px">Name</th>

</tr>

</thead>

</table>

</div> <a href="javascript:dijit.byId('dialog').show();">Open dialog</a>

</body>

</html> }}}

Change History (4)

comment:1 Changed 10 years ago by Adam Peller

Component: GeneralDojoX Grid
Owner: changed from anonymous to Nathan Toone

comment:2 Changed 10 years ago by Nathan Toone

Resolution: invalid
Status: newclosed

This is due to the fact that the dialog is trying to size itself to the size of its content, and the grid is getting sized to the size of the dialog...the net result is them both getting no width.

You need to specify a width on either the dialog or the grid. In this case, I would suggest putting width:300px on your grid (since that's the net width of your columns).

comment:3 Changed 10 years ago by bill

Description: modified (diff)

I thought that the Grid did specify a size on itself since each column has a width specified (100px and 200px) and since it says autoHeight=true. Not so?

comment:4 Changed 10 years ago by Nathan Toone

The width of a grid is independent of the sum width of it's columns unless autoWidth is set. I would assume that this setup would work if autoWidth were set.

Note: See TracTickets for help on using tickets.