Skip to content

Commit 368d619

Browse files
author
Jimmy Jia
committed
Make collapsable panels work with 'fill' elements
1 parent 376485e commit 368d619

2 files changed

Lines changed: 3 additions & 15 deletions

File tree

docs/examples/PanelListGroupFill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var panelInstance = (
2-
<Panel header="Panel heading">
2+
<Panel collapsable defaultExpanded header="Panel heading">
33
Some default panel content here.
44
<ListGroup fill>
55
<ListGroupItem>Item 1</ListGroupItem>

src/Panel.jsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var Panel = React.createClass({
4242
},
4343

4444
getCollapsableDimensionValue: function () {
45-
return this.refs.body.getDOMNode().offsetHeight;
45+
return this.refs.panel.getDOMNode().scrollHeight;
4646
},
4747

4848
getCollapsableDOMNode: function () {
@@ -80,19 +80,7 @@ var Panel = React.createClass({
8080
var bodyElements = [];
8181

8282
function getProps() {
83-
var index = bodyElements.length;
84-
var props = {key: index};
85-
86-
// Arbitrarily assign the body ref to the first element. We can't wrap
87-
// all body elements in a single DOM node, because the selector for the
88-
// panel-filling behavior in Bootstrap looks like ".panel>.list-group",
89-
// which will not work if there are any DOM nodes between the ".panel"
90-
// element and the ".list-group" element.
91-
if (index == 0) {
92-
props.ref = 'body';
93-
}
94-
95-
return props;
83+
return {key: bodyElements.length};
9684
}
9785

9886
function addPanelBody (children) {

0 commit comments

Comments
 (0)