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.

KeyField enhancement suggestion

See original GitHub issue
  • Sometimes the data that comes back from the server has no suitable key. https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/166 (Like data from several different sources in one result, etc). the table requires a keyField. So, what happens is I create an extra field in my object, do a map operation on it to set the keyFields to a simple rowIndex number:
data.map((val, ix) => {
                            val.id = ix
                            return val
                        }),
data.map((val, ix) => {
                            val.id = val.field1+value.field2
                            return val
                        }),

I would like to propose a better solution to the above.

The other part of this solution is the automatic numbering. Since the formatter function receives a rowIndex as a parameter, it could simply return this number.

Currently the table requires keyField property to be populated. The above implementation would imply that it would require keyField or a column isKeyField=true. However, I think it would would be a good feature of the table that if there is no keyField set on the table…and no isKeyField column, that the rowIndex would be used as a default implementation.

I think this solves all the referenced tickets and seems like it would be a fairly easy implementation? If this isKeyField existed, I would personally always use that instead of the keyField property…possibly you could consider deprecating the keyField property on the table in favor of the much more flexible column definition.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
jordan1982commented, Mar 19, 2019

@AllenFang Any updates on this? I’m really interested in this update, could you tell me when you’ll implement this feature? Or you can suggest me how to use the bootstrap table with a composite key?

4reactions
senthilmca90commented, Feb 14, 2019

@AllenFang Any update on this one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

se11 DB-view buffered, how to? Improvement suggestion?
se11, View for two DB-Tables (inner join), trying to use SAP-Table-buffer (on the view(!), not the tables) given: say, I have 2 million ......
Read more >
NetSuite Applications Suite - Voting for Enhancements
... Generate Credential Field · Add a Secret Key Field · Add a Field that Displays Running Total to a Sublist · Parse...
Read more >
Improvement Suggestions - QuickBooks - Intuit
Have app for downloading and importing fields, but cannot alter customer name as this is the key field. Had one customer who changed...
Read more >
RFC 2890 - Key and Sequence Number Extensions to GRE
This document describes enhancements by which two fields, Key and Sequence Number, can be optionally carried in the GRE Header [1]. The Key...
Read more >
000042: Failed to create the address locator. - Esri Community
Field Map 'Feature ID' Location VISIBLE NONE;*KeyField OID VISIBLE ... our hope is that this enhancement will eliminate confusion like this ...
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