Code Monkey home page Code Monkey logo

virtualized-table-for-antd's Introduction

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 'virtualizedtableforantd4';
    
    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

virtualized-table-for-antd's People

Contributors

wubostc avatar frozzy6 avatar zomixi avatar nokecy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.