Giter Site home page Giter Site logo

Nested Rows support ? about table HOT 2 CLOSED

react-component avatar react-component commented on June 18, 2024
Nested Rows support ?

from table.

Comments (2)

jlc467 avatar jlc467 commented on June 18, 2024 1

Take a look at http://react-component.github.io/table/examples/childrenIndent.html

For you, try something like:

/* eslint-disable no-console,func-names,react/no-multi-comp */
const React = require('react');
const ReactDOM = require('react-dom');
const Table = require('rc-table');
require('rc-table/assets/index.less');

const columns = [{
  title: 'Name',
  dataIndex: 'name',
  key: 'name',
  width: 400,
  render: (v, record) => {
    if (v === 'Add new row') return <a href="#">{v}</a>
    return v
  }
}, {
  title: 'Count',
  dataIndex: 'count',
  key: 'count',
  width: 100,
}];

const data = [{
  key: 1,
  name: 'Light Motor Vehicles',
  count: 9,
  children: [{
    key: 11,
    name: 'Car',
    count: 2
  }, {
    key: 12,
    name: 'motorcycles',
    count: 3
  },
  {
    key: 13,
    name: 'Add new row',

  }]
}];

function onExpand(expanded, record) {
  console.log('onExpand', expanded, record);
}

ReactDOM.render(
  <Table defaultExpandAllRows columns={columns} data={data} indentSize={30} onExpand={onExpand} />,
  document.getElementById('__react-content')
);

from table.

mayanksahai avatar mayanksahai commented on June 18, 2024 1

Hi i was looking into Subtable example and have some issues incorporating
that into my app.

i have written service using spring-rest and service return response in
json format:

  1. Object
    1. content:Array[1]
      1. 0:Object
        1. content:Array[0]
        2. dateTime:Object
        3. links:Array[3]
          1. 0:Object
            1. href:"http://localhost:8080/api/expenseReports/1"
            2. rel:"self"
            3. proto:Object
          2. 1:Object
            1. href:"http://localhost:8080/api/expenseReports/1"
            2. rel:"expenseReport"
            3. proto:Object
          3. 2:Object
            1. href:"
              http://localhost:8080/api/expenseReports/1/children"
            2. rel:"children"
            3. proto:Object
          4. length:3
          5. proto:Array[0]
        4. name:"Dec month report"
        5. value:0

that is incompatible to format given in example:

[ { a: 'a1', }, { a: 'a2', b: 'b2', children: [ { a: 'a2-1', b: 'b2-1', },
{ a: 'a2-2', b: 'b2-2', }, ], }, { a: 'a3', c: 'c3', d: 'd3', }, ];

i think "links" in my response has to be named as "children" to make it
work.

  1. do i need to transform response to match structure component expects
  2. do you have any example for the same.

thanks

mayank

On Mon, Nov 14, 2016 at 1:14 PM, Wei Zhu [email protected] wrote:

Closed #101 #101.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#101 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAiGlpccO5ouyxS9BAFwQ9Iiw-GnZmPqks5q9-43gaJpZM4KwtrV
.

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.