Coder Social home page Coder Social logo

关于table的问题 about react-ui HOT 5 OPEN

zhangqhzz avatar zhangqhzz commented on August 16, 2024
关于table的问题

from react-ui.

Comments (5)

zhangqhzz avatar zhangqhzz commented on August 16, 2024

实际上Table中的filter sort均是需要向后台请求的,目前的Table只能一次性取出全部数据然后再处理

from react-ui.

Lobos avatar Lobos commented on August 16, 2024

不用内置的分页,用Pagination组件。

from react-ui.

zhangqhzz avatar zhangqhzz commented on August 16, 2024

不知如何用,因为Table组件是compose(
Fetch(true),
Filter,
Sort,
Pagination
)(Table)的,都内置了

from react-ui.

zhangqhzz avatar zhangqhzz commented on August 16, 2024

在使用Table组件时,不设置pagination,然后在Table下加<Pagination .../>吗? 这样没有组合的来得方便了

from react-ui.

Lobos avatar Lobos commented on August 16, 2024

嗯,是这样的,因为每个业务涉及到分页的情况都不一样,所以不好做成通用的组件。复用的话,自己外面在封装一层就可以了。大概类似这样。

class CustomTable extends Component {
  constructor(props) {
    // ...
    this.state = { page = 1, size = 20 }
  }

  componentDidMount() {
    this.fetch()
  } 

  fetch() {
    // fetch data
    const { page, size } = this.state
    fetch(this.props.baseUrl, {page,size}).then(...)
  }

  handlePageChange() {
     this.setState({...},  this.fetch)
  }

  render() {
    <Table />
    <Pagination />
  }
}

from react-ui.

Related Issues (20)

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.