Skip to content

Instantly share code, notes, and snippets.

@kfranqueiro
Created January 5, 2012 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfranqueiro/1563785 to your computer and use it in GitHub Desktop.
Save kfranqueiro/1563785 to your computer and use it in GitHub Desktop.
Test page attempting to reproduce dgrid issue #59
<!DOCTYPE html>
<html>
<head>
<title>Test Issue #59</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=570"/>
<style type="text/css">
@import "../../dijit/themes/claro/document.css";
@import "../../dijit/themes/claro/claro.css";
@import "../css/dgrid.css";
@import "../css/skins/claro.css";
.dgrid {
height: 10em;
}
</style>
<script type="text/javascript" src="../../dojo/dojo.js"
data-dojo-config="async: true"></script>
<script type="text/javascript">
require(["dgrid/OnDemandGrid",
"dojo/_base/lang",
"dojo/_base/declare",
"dojo/parser",
"dojo/store/Memory",
"dojo/store/Observable",
// widgets only used declaratively
"dijit/layout/TabContainer",
"dijit/layout/ContentPane",
"dijit/TitlePane",
// non-returns
"dojo/domReady!"
], function(Grid, lang, declare, parser, Memory, Observable){
var
gridCols = window.gridCols = {
col1: 'Column 1',
col2: 'Column 2',
col3: 'Column 3'
},
// store with single item, to test GH issue #59
testStore = window.testStore = Observable(new Memory({ data: [
{ id: 1, col1: "foo", col2: "bar", col3: "baz" }
]}));
// simply passing columns via data-dojo-props, don't want GridFromHtml
window.dgrid = { Grid: Grid };
// attempting to reproduce GH issue #59 - but not getting the same result
var grid2 = window.grid2 = new Grid({
columns: gridCols,
store: testStore
}, "gridTab2");
grid2.startup();
// this should probably really be done before the 2nd grid is created,
// but doing this after arrives the closest I could get to the
// apparent behavior of the test in issue #59.
// (There are separate issues with doing it "the right way" anyway.)
parser.parse();
});
</script>
</head>
<body class="claro">
<div data-dojo-type="dijit.layout.TabContainer" id="tc"
data-dojo-props="doLayout: false">
<!-- initial tab: dgrid inside contentpane -->
<div data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="id: 'tab1', title: 'Tab 1'">
<div data-dojo-type="dgrid.Grid" id="gridTab1" class="gridTab"
data-dojo-props="store: testStore, columns: gridCols"></div>
</div>
<!-- tab 2: dgrid inside titlepane inside contentpane (GH issue #59) -->
<div data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="id: 'tab2', title: 'Tab 2'">
<div data-dojo-type="dijit.TitlePane" title="grid inside">
<div>foo</div><!-- extra child to suppress single-child behavior -->
<div id="gridTab2" class="gridTab"></div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment