Code Monkey home page Code Monkey logo

Comments (6)

kevalbhatt avatar kevalbhatt commented on June 4, 2024 1

This is my code

class AssesmentTable extends Component {
render() {
const {routes, strandData} = this.props;
const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
    width: 300,
    fixed: 'left'
  }, {
    title: 'Age',
    dataIndex: 'age',
    key: 'age'
  }, {
    title: 'Address',
    dataIndex: 'address',
    key: 'address'
  }
];

const data = [
  {
    name: 'Jack',
    age: 28,
    address: 'some where',
    children: [
      {
        name: 'a2-1',
        b: 'b2-1'
      }, {
        name: 'a2-2',
        b: 'b2-2'
      }
    ]
  }, {
    name: 'Rose',
    age: 36,
    address: 'some where'
  }
];
/*  take out everything required from props */

return (
  <div className="panel-body">
    <Table columns={columns} style={{
      width: 800
    }} data={data} expandIconAsCell={true} defaultExpandAllRows={true} scroll={{
      x: 1200
    }}/>
  </div>
);
}
}

now I click on plus button it want open and even its not expanded by default.

Warning which I saw in console.

Warning: flattenChildren(...): Encountered two children with the same key, 0. Child keys must be unique; when two children share a key, only the first child will be used.

from table.

amitkverma avatar amitkverma commented on June 4, 2024 1

expandedRowKeys must be unique for defaultExpandAllRows to work

from table.

yesmeck avatar yesmeck commented on June 4, 2024

Could you post your code?

from table.

kevalbhatt avatar kevalbhatt commented on June 4, 2024

@yesmeck I found issue why defaultExpandAllRows is not working.

In data object key is not unique so is it possible to create key from your side if user not provide key in data object?

from table.

yesmeck avatar yesmeck commented on June 4, 2024

Will do generate keys based on index of data if no rowKey given. https://github.com/react-component/table/blob/master/src/Table.jsx#L175-L181

from table.

yesmeck avatar yesmeck commented on June 4, 2024

Yes, It's confusing now, you can set rowKey by yourself.

from table.

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.