Opened 11 years ago

Closed 11 years ago

#8556 closed defect (fixed)

Bug in dojox.grid setStructure

Reported by: Yves Blusseau Owned by: Nathan Toone
Priority: high Milestone: 1.3
Component: DojoX Grid Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

Hi, i think a find a bug. dojo try to delete an inexistant node when we change data AND structure of a grid.

If you start the page below with firebug activated and try to click on "Data1 and Layout 1" button then "Data2 and Layout 2" you will see the bug. The problem seems that dojo try to remove to many rowNode when you change the structure AND you change the data: it try to delete the number of rows in data1 when you are in a view of data2 (but data2 has less rows than data1) Here the page to reproduce the bug:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Test dojox.grid.Grid Simple Structure</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
	<style type="text/css">
		@import "js/dojo/dojox/grid/resources/Grid.css";
		@import "js/dojo/dojox/grid/resources/tundraGrid.css";
		@import "js/dojo/dojo/resources/dojo.css";
		@import "js/dojo/dijit/themes/tundra/tundra.css";
		body {
			font-size: 0.9em;
			font-family: Geneva, Arial, Helvetica, sans-serif;
		}
		.heading {
			font-weight: bold;
			padding-bottom: 0.25em;
		}
				
		#grid {
			border: 1px solid #333;
			width: 35em;
			height: 30em;
		}
	</style>
	<script type="text/javascript" src="js/dojo/dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true"></script>
	<script type="text/javascript">
		dojo.require("dojox.grid.DataGrid");
		dojo.require("dojo.data.ItemFileWriteStore");
		dojo.require("dojo.parser");
	</script>
	<script type="text/javascript">
		var layout1 = [
			{name: 'Host', field: 'host'},
	        {name: 'Column 1', field: 'c1'},
		];
		var layout2 = [
			{name: 'Host', field: 'host'},
	        {name: 'Column 2', field: 'c2'},
		];
	    var data1 = { identifier: 'host', 'label': 'host',
	                 items: [ { 'host':'aaa', 'c1':1, 'c2':2 }, { 'host':'abc','c1':1, 'c2':2 }, { 'host':'bbb','c1':1,'c2':2 } ]};
	    var data2 = { identifier: 'host', 'label': 'host',
	                 items: [ { 'host':'xxx', 'c1':1, 'c2':2 } ]};
	    test_store = new dojo.data.ItemFileWriteStore({data: { items: [] }});

	    function data1AndLayout1() {
	        test_store = new dojo.data.ItemFileWriteStore({data: data1});
	        grid.setStore(test_store);
	        grid.setStructure(layout1);
	    }
	    function data2AndLayout2() {
	        test_store = new dojo.data.ItemFileWriteStore({data: data2});
	        grid.setStore(test_store);
	        grid.setStructure(layout2);
	    }
</script>
</head>
<body class='tundra'>
<div class="heading">Test Bug Grid...</div>
<button onClick="data1AndLayout1()">Data1 and Layout 1</button>
<button onClick="data2AndLayout2()">Data2 and Layout 2</button>
<div jsid="grid" id="grid" dojoType="dojox.grid.DataGrid" store="test_store" structure="layout1"></div>
</body>
</html>

Attachments (1)

grid_structure_bug.html (2.3 KB) - added by Yves Blusseau 11 years ago.
HTML file to reproduce the bug (in firebug)

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Yves Blusseau

Attachment: grid_structure_bug.html added

HTML file to reproduce the bug (in firebug)

comment:1 Changed 11 years ago by Bryan Forbes

Milestone: tbd1.3
Owner: changed from Bryan Forbes to Nathan Toone
Priority: normalhigh

comment:2 Changed 11 years ago by Nathan Toone

Resolution: fixed
Status: newclosed

This appears to be working now in the latest trunk.

Note: See TracTickets for help on using tickets.