You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/10/01 22:56:10 UTC

[GitHub] [incubator-superset] eschutho commented on a change in pull request #10999: refactor: Remove usages of reactable from TableLoader

eschutho commented on a change in pull request #10999:
URL: https://github.com/apache/incubator-superset/pull/10999#discussion_r498551091



##########
File path: superset-frontend/src/components/TableLoader.jsx
##########
@@ -71,40 +99,26 @@ class TableLoader extends React.PureComponent {
       ...tableProps
     } = this.props;
 
-    let { columns } = this.props;
-    if (!columns && this.state.data.length > 0) {
+    let { columns = [] } = this.props;
+    if (columns.length === 0 && this.state.data.length > 0) {
       columns = Object.keys(this.state.data[0]).filter(col => col[0] !== '_');
     }
     delete tableProps.dataEndpoint;
     delete tableProps.mutator;
     delete tableProps.columns;
 
     return (
-      <Table
-        {...tableProps}
-        className="table"
-        itemsPerPage={50}
-        style={{ textTransform: 'capitalize' }}
-      >
-        {this.state.data.map((row, i) => (
-          <Tr key={i}>
-            {columns.map(col => {
-              if (row.hasOwnProperty(`_${col}`)) {
-                return (
-                  <Td key={col} column={col} value={row[`_${col}`]}>
-                    {row[col]}
-                  </Td>
-                );
-              }
-              return (
-                <Td key={col} column={col}>
-                  {row[col]}
-                </Td>
-              );
-            })}
-          </Tr>
-        ))}
-      </Table>
+      <ListView
+        columns={columns.map(column => ({
+          accessor: column,
+          Header: column,
+        }))}
+        data={this.state.data}
+        count={this.state.data.length}

Review comment:
       Ok, sounds good. 👍 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org