Have ideas to improve npm?Join in the discussion! »

    virtualizedtableforantd4
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    The virtualized table component for AntD4,fast, restorable and smallest size for gzip!

    npm dm license

    NPM

    • Install

      npm i --save virtualizedtableforantd4
    • the opts of useVT(examples)

      interface vt_opts {
        id?: number;
        /**
         * @default 5
         */
        overscanRowCount?: number;
       
        /**
         * this only needs the scroll.y
         */
        scroll?: {
          y: number;
        };
       
        /**
         * wheel event(only works on native events).
         */
        onScroll?: ({ left, top, isEnd, }:
          { top: number; left: number; isEnd: boolean }) => void;
       
        initTop?: number;
       
        /**
         * @default false
         */
        debug?: boolean;
       
       
        // pass -1 means scroll to the bottom of the table
        ref?: React.MutableRefObject<{
          scrollTo: (y: number) => void;
        }>
      }
    • Quick start

      You need to change your style like following if your Table.size is not default.

      如果你的Table.size不是默认的话,你需要修改像下面一样的style。

      // size={'small'} 
      ant-table [vt] > table > .ant-table-tbody > tr > td {
          padding: 8px;
      }
      import React from 'react';
      import { Table } from 'antd';
      import { useVT } from 'virtualedtableforantd4';
       
      const [ vt, set_components ] = useVT(() => ({ scroll: { y: 600 } }), []);
       
      <Table
        scroll={{ y: 600 }} // It's important for using VT!!! DO NOT FORGET!!!
        components={vt}
        columns={/*your columns*/}
        dataSource={/*your data*/}
      />
    • Scroll to

    • Restoring last state

    • Editable Table

    • Drag soring

    License

    MIT

    Install

    npm i virtualizedtableforantd4

    DownloadsWeekly Downloads

    1,851

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    58.6 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar