question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table works until search is added

See original GitHub issue

The table works but when I add the search property to the table, it gives this error:

BootstrapTable.js:1355 Uncaught TypeError: Cannot read property 'isKey' of undefined at http://localhost:3000/static/js/bundle.js:66034:31 at Array.map (native) at BootstrapTable.renderToolBar (http://localhost:3000/static/js/bundle.js:66031:31) at BootstrapTable.render (http://localhost:3000/static/js/bundle.js:65192:27) at http://localhost:3000/static/js/bundle.js:26983:22 at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:26262:13) at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (http://localhost:3000/static/js/bundle.js:26982:26) at ReactCompositeComponentWrapper._renderValidatedComponent (http://localhost:3000/static/js/bundle.js:27009:33) at ReactCompositeComponentWrapper._updateRenderedComponent (http://localhost:3000/static/js/bundle.js:26933:37) at ReactCompositeComponentWrapper._performComponentUpdate (http://localhost:3000/static/js/bundle.js:26911:11)

My code:

let stagings = this.getStagingsFlattened();
let identifiers = [];
for (let i = 0; i < this.props.stagings[0].identifiers.length; i++) {
    let data = "identifiers." + i + ".value";
    identifiers.push(<TableHeaderColumn dataField={data} key={Math.random() * 99999999999999999}
    dataSort={ true }>{this.props.stagings[i].identifiers[i].name}</TableHeaderColumn>)
}
let attributes = [];
for (let i = 0; i < this.props.stagings[0].attributes.length; i++) {
    let data = "attributes." + i + ".value";
    identifiers.push(
        <TableHeaderColumn dataField={data} key={Math.random()*99999999999999999}
   dataSort={ true }>{this.props.stagings[i].attributes[i].name}</TableHeaderColumn>)
}
return (
    <div className="container">
        <BootstrapTable ref='table' data={ stagings } hover>
<TableHeaderColumn dataField='id' isKey={ true } key={Math.random()*99999999999999999} dataSort={ true }>Id</TableHeaderColumn>
{identifiers}
{attributes}
        </BootstrapTable>
    </div>
)
function flatten(o) {
    let prefix = arguments[1] || "", out = arguments[2] || {}, name;
    for (name in o) {
        if (o.hasOwnProperty(name)) {
            typeof o[name] === "object" ? flatten(o[name], prefix + name + '.', out) :
                out[prefix + name] = o[name];
        }
    }
    return out;
}

Original Json [ { “id”:1, “identifiers”:[ { “id”:2, “name”:“example”, “value”:“example” } ], “attributes”:[ { “id”:1, “name”:“example”, “value”:“example” } ] } ]

Flattened json { “0.id”:1, “0.identifiers.0.id”:2, “0.identifiers.0.name”:“example”, “0.identifiers.0.value”:“example”, “0.attributes.0.id”:1, “0.attributes.0.name”:“example”, “0.attributes.0.value”:“example” }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
AllenFangcommented, May 10, 2017

remove isKey={ true } and add keyField='id' on BootstrapTable

return (
    <div className="container">
        <BootstrapTable ref='table' data={ stagings } hover>
{keycolumn}
{identifiers}
{attributes}
        </BootstrapTable>
    </div>
)

but I suggest your to do render like following

return (
    <div className="container">
        <BootstrapTable ref='table' data={ stagings } hover>
            { allcolumns }
        </BootstrapTable>
    </div>
)
0reactions
AllenFangcommented, May 14, 2017

Very appreciate @MichielDx’s response.

Only way it works is when I merge cols1 and cols2

yes, sure, I think theres no reason for developer to generate the same thing(TableHeaderColumn) via multiple function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Show hidden tables until search button clicked - Stack Overflow
I have a search box that makes a request within a table and displays the queried results. I want the tables to remain...
Read more >
Add records to a table by using an append query
Open the database that contains the records that you want to copy. On the Create tab, in the Queries group, click Query Design....
Read more >
Search Within Tables - Infoplus
Use advanced search filters to find exactly the data you are looking for on any table within Infoplus. · 1. Search by keyword(s)...
Read more >
Launched: Search tables without disrupting your teammates
Just use the Search icon in the right-hand corner of your table to find the information you need without disrupting your teammate's work....
Read more >
7.8. WITH Queries (Common Table Expressions) - PostgreSQL
The SEARCH clause specifies whether depth- or breadth first search is wanted, the list of columns to track for sorting, and a column...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found