Skip to content

Commit 3122432

Browse files
committed
lookup: fix dynamic list loading
1 parent d554315 commit 3122432

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

components/SLDSLookup/Menu/Item/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Item extends React.Component {
3434

3535
handleClick(e){
3636
EventUtil.trapImmediate(e);
37+
console.log('>>> this.props.id: ',this.props.id);
3738
return this.props.onSelect(this.props.id);
3839
}
3940

@@ -80,6 +81,7 @@ Item.propTypes = {
8081
setFocus: React.PropTypes.func,
8182
handleItemFocus: React.PropTypes.func,
8283
onSelect: React.PropTypes.func,
84+
data: React.PropTypes.object
8385
};
8486

8587
Item.defaultProps = {

components/SLDSLookup/Menu/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ class Menu extends React.Component {
3939
return this.props.items.filter(this.filter, this).map((c, i) => {
4040
//isActive means it is aria-activedescendant
4141
const isActive = this.props.focusIndex === i + 1 ? true : false;
42+
const id = 'item-'+i;
4243
return <Item
43-
key={c.id}
44-
id={c.id}
44+
key={id}
45+
id={id}
4546
type={this.props.type}
4647
searchTerm={this.props.searchTerm}
4748
index={i}
4849
isActive={isActive}
4950
setFocus={this.props.setFocus}
5051
handleItemFocus={this.handleItemFocus.bind(this)}
5152
onSelect={this.props.onSelect}
53+
data={c}
5254
>
5355
{c}
5456
</Item>

components/SLDSLookup/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SLDSLookup extends React.Component {
2525
super(props);
2626

2727
//Dynamically assign ids to list items to reference for focusing and selecting items
28-
this.props.items.map((item, index) => { return item.id = 'item-' + index; })
28+
// this.props.items.map((item, index) => { return item.id = 'item-' + index; })
2929

3030
this.state = {
3131
searchTerm: '',
@@ -179,7 +179,6 @@ class SLDSLookup extends React.Component {
179179
// Rendering Things
180180
renderMenuContent(){
181181
if(this.state.isOpen){
182-
183182
return <Menu
184183
searchTerm={this.state.searchTerm}
185184
label={this.props.label}

0 commit comments

Comments
 (0)