lyndsiWilliams commented on code in PR #22135:
URL: https://github.com/apache/superset/pull/22135#discussion_r1023407724


##########
superset-frontend/src/components/Table/VirtualTable.tsx:
##########
@@ -0,0 +1,154 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Table } from 'antd';
+import type { TableProps } from 'antd/es/table';
+import classNames from 'classnames';
+import ResizeObserver from 'rc-resize-observer';
+import React, { useEffect, useRef, useState } from 'react';
+import { VariableSizeGrid as Grid } from 'react-window';
+import styled from '@emotion/styled';
+
+// If a column definition has no width, react-window will use this as the 
default column width
+const DEFAULT_COL_WIDTH = 150;
+
+const StyledCell = styled.div`
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  padding-left: 8px;
+  padding-right: 4px;

Review Comment:
   ```suggestion
   const DEFAULT_COL_WIDTH = ${supersetTheme.gridUnit * 37.5}px;
   
   const StyledCell = styled.div`
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
     padding-left: ${supersetTheme.gridUnit * 2}px;
     padding-right: ${supersetTheme.gridUnit}px;
   ```
   These should use the superset theme's gridunit for sizing.



##########
superset-frontend/src/components/Table/Table.overview.mdx:
##########
@@ -183,14 +183,27 @@ The table displays a set number of rows at a time, the 
user navigates the table
 The default page size and page size options for the menu are configurable via 
the `pageSizeOptions` and `defaultPageSize` props.
 NOTE: Pagination controls will only display when the data for the table has 
more records than the default page size.
 
-<Story id="design-system-components-table-examples--many-columns" />
+<Story id="design-system-components-table-examples--pagination" />
 
 ```
 <Table pageSizeOptions={[5, 10, 15, 20, 25] defaultPageSize={10} />
 ```
 
 ---
 
+### Virtualization for Performance
+
+The Table virtualization can be used to enable viewing data with many columns 
and or rows without paging.
+Virtualization can be enabled via the `virtualize` prop. Pagination is shown 
in this example but can be truned off by setting `pagination={false}`

Review Comment:
   ```suggestion
   Virtualization can be enabled via the `virtualize` prop. Pagination is shown 
in this example but can be turned off by setting `pagination={false}`
   ```



##########
superset-frontend/src/components/Table/index.tsx:
##########
@@ -167,6 +177,20 @@ const StyledTable: StyledComponent<any> = 
styled(AntTable)<any>`
   `}
 `;
 
+const StyledVirtualTable: StyledComponent<any> = styled(VirtualTable)<any>`
+  .virtual-table .ant-table-container:before,
+  .virtual-table .ant-table-container:after {
+    display: none;
+  }
+  .virtual-table-cell {
+    box-sizing: border-box;
+    padding: 16px;

Review Comment:
   ```suggestion
       padding: ${supersetTheme.gridUnit * 4}px;
   ```



-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

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


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

Reply via email to