Opened 12 years ago
Closed 12 years ago
#7349 closed enhancement (fixed)
ContentPane: setContent does not allow Widgets
Reported by: | Joscha Feth | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | Dijit | Version: | 1.1.1 |
Keywords: | ContentPane, setContent, Grid | Cc: | |
Blocked By: | Blocking: |
Description
When using ContentPane? to display a dojox.Grid component in it, the normal way of setting contents does not work:
var cp = new dijit.layout.ContentPane({...},someDiv); var gridDiv = document.createElement('div'); someDiv.appendChild(gridDiv); var grid = new dojox.grid.DataGrid({...},gridDiv); cp.setContent(grid); // this does not work... cp.startup();
If you set cp._singleChild to contain the widget instead, it works:
var cp = new dijit.layout.ContentPane({...},someDiv); var gridDiv = document.createElement('div'); someDiv.appendChild(gridDiv); var grid = new dojox.grid.DataGrid({...},gridDiv); cp._singleChild = grid; // this works! cp.startup();
Attachments (1)
Change History (5)
comment:1 Changed 12 years ago by
Summary: | setContent of ContentPane does not allow Widgets → ContentPane: setContent does not allow Widgets |
---|---|
Type: | defect → enhancement |
comment:2 Changed 12 years ago by
Oh hmm, ignore above comment; the API doc is just out of date; that feature is already there. I'll investigate why your code snippet isn't working.
comment:3 Changed 12 years ago by
Milestone: | tbd → 1.2 |
---|---|
Owner: | set to bill |
Status: | new → assigned |
Ugh, ignore my previous comment to "ignore above comment"... even in the newest version of ContentPane, setContent()
can only take a string, a dom node, or a node list.
There's also a problem with your code snippet:
someDiv.appendChild(gridDiv); var grid = new dojox.grid.DataGrid({},gridDiv); cp.setContent(grid); // this does not work...
The first line serves no purpose, and actually messes things up, since the setContent() call first deletes all existing content in the ContentPane, including the gridDiv.
Anyway, I will enhance setContent() to be able to take a widget.
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [14681]) Fixes #7349: Allow ContentPane?.setContent() to take a widget. !strict
Changed 12 years ago by
Attachment: | test_ContentPane.html added |
---|
corrected testcase (but doesn't do much since the Grid has no data store or other options specified)
As your title says, setContent() doesn't take a widget, see the API doc. This isn't a bug per se, it would be an enhancement.
It's because ContentPane is meant to hold free form HTML.