Skip to content

Commit 3bcd936

Browse files
author
Masakorala, Manoj
committed
minor change
1 parent bf9ec2f commit 3bcd936

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

examples/src/js/BasicExample.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ const nodes = [
279279
]
280280

281281
const inputSelected = [
282+
{ hotel: 152, rate: 'arise|722'}, { hotel: 155, rate: 'arise|519' }
282283
]
283284
const hotelInputSelcted = [
285+
{ hotel: "f922f8df", rates: ["arise-865"] },
286+
{ hotel: "672a", rates: ["arise-865", "arise-861"] }
284287
]
285288
class BasicExample extends React.Component {
286289

@@ -289,7 +292,7 @@ class BasicExample extends React.Component {
289292
super(props);
290293
this.state = {
291294
checked: [
292-
295+
152
293296
],
294297
expanded: [
295298

@@ -306,22 +309,25 @@ class BasicExample extends React.Component {
306309

307310
onCheck(checked, info) {
308311
console.log(checked, info);
312+
this.setState({ hotelRates : [{ hotel: "f922f8df", rates: ["arise-865"] },
313+
{ hotel: "672a", rates: ["arise-865", "arise-861", "arise-863"] }] }, console.log('test: ', this.state.hotelRates ))
309314
this.setState({ checked });
315+
310316
}
311317

312318
onExpand(expanded) {
313319
this.setState({ expanded });
314320
}
315321

316322
onRateChange(data) {
317-
console.log("parent", data);
323+
// console.log("parent", data);
318324
this.setState({ rate: data })
325+
319326
}
320327

321328
onHotelRateChange(data){
322-
console.log("onHotelRateChange", data);
329+
// console.log("onHotelRateChange", data);
323330
this.setState({ hotelRates: data })
324-
325331
}
326332

327333
render() {

src/js/CheckboxTree.js

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ class CheckboxTree extends React.Component {
261261
// This is done during rendering as to avoid an additional loop during the
262262
// deserialization of the `checked` property
263263
flatNode.checkState = this.determineShallowCheckState(node, noCascade);
264+
// flatNod.parentInputs = this.determineParentInputs(node, flatNode.treeDepth);
264265

265266
// Show checkbox only if this is a leaf node or showCheckbox is true
266267
const showCheckbox = onlyLeafCheckboxes ? flatNode.isLeaf : flatNode.showCheckbox;

src/js/TreeNode.js

+7
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ class TreeNode extends React.Component {
7373
this.onChangeCallback = this.onChangeCallback.bind(this);
7474
}
7575

76+
componentDidUpdate(prevProps) {
77+
if (this.props.multiInputValue !==
78+
prevProps.multiInputValue && this.props.treeDepth === 0) {
79+
this.setState({ hotelRates: this.props.multiInputValue?.map(data => ({'value': data, 'label': this.props.rateList?.find(rate => rate.value === data)?.label }) ) })
80+
}
81+
}
82+
7683
onCheck() {
7784
const { value, onCheck } = this.props;
7885

0 commit comments

Comments
 (0)