Opened 8 years ago

Closed 6 years ago

#14725 closed defect (patchwelcome)

Width of rowSelector is not correct when dlg.show() is after grid.startup()

Reported by: helloworld Owned by: Evan
Priority: undecided Milestone: tbd
Component: DojoX Grid Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description

hi all,

Please refer to the attached rowSelectorWidth.jpg Why the order of dlg.show() and grid.startup() is important.

html code:

<div id="setCurDlg" data-dojo-type="dijit.Dialog" data-dojo-id="setCurDlg" title="Select the current project:">
<div id="gridContainer" style="width:100%;height:15em;">

js code for right display: setCurDlg.show() is before grid.startup()

setCurDlg.show();       //show() first.

var data = {
	identifier: 'id',
	label: 'id',
	items: []
};
data.items = [
			{
				name: "foo 0.1",
				id:20001,
				alias: "bar 0.1"
			},
			{
				name: "foo 1",
				id:20002,
				alias: "bar 1"
			}
		];

var test_store = new dojo.data.ItemFileWriteStore({data: data});

var layout = [[
		{name: 'Project name', field: 'name', 'width': '50%'},
		{name: 'Code name', field: 'alias', 'width': '50%'}
	]];
		
var grid = new dojox.grid.EnhancedGrid({
					id: "list",
					store: test_store,
					structure: layout,
					style:"width:500px;height:300",
					rowSelector: '60px'
				}, dojo.byId('gridContainer'));
grid.startup();


and js code for wrong display: setCurDlg.show() is after grid.startup()

var data = {
	identifier: 'id',
	label: 'id',
	items: []
};
data.items = [
			{
				name: "foo 0.1",
				id:20001,
				alias: "bar 0.1"
			},
			{
				name: "foo 1",
				id:20002,
				alias: "bar 1"
			}
		];

var test_store = new dojo.data.ItemFileWriteStore({data: data});

var layout = [[
		{name: 'Project name', field: 'name', 'width': '50%'},
		{name: 'Code name', field: 'alias', 'width': '50%'}
	]];
		
var grid = new dojox.grid.EnhancedGrid({
					id: "list",
					store: test_store,
					structure: layout,
					style:"width:500px;height:300",
					rowSelector: '60px'
				}, dojo.byId('gridContainer'));
grid.startup();

setCurDlg.show();        //show() at last.

Attachments (1)

rowSelectorWidth.jpg (42.4 KB) - added by helloworld 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by helloworld

Attachment: rowSelectorWidth.jpg added

comment:1 Changed 8 years ago by bill

Component: GeneralDojoX Grid
Owner: set to Evan

It would be better if you attached the actual test case, but it looks like the problem is that you are calling startup() on the grid while it's hidden, and grid doesn't react well to that. It should work, since dialog.show() will call grid.resize().

In other words, If Grid has a parent with layoutContainer:true, then Grid should wait for a resize() call from it's parent widget in order to do layout.

comment:2 Changed 6 years ago by bill

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

We will consider patches to the old DojoX Grid code though.

comment:3 Changed 6 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.