GithubHelp home page GithubHelp logo

Comments (4)

Austint30 avatar Austint30 commented on September 22, 2024

Moving the rowFormatter function to the options attribute seems to work.

<ReactTabulator
    columns={[...]}
    data={[...]}
    options={{
        rowFormatter={(row) => {...}} //<- This works
    }}
/>

I find it odd how using options like height and layout work at the root level of the Component's props, but other options like rowFormatter must be put under options.

from react-tabulator.

ngduc avatar ngduc commented on September 22, 2024

Thanks for reporting.
rowFormatter was missing as a first-class prop. I've just fixed it in the latest version.
Later on, I may have some pass-through logic to add all tabulator options as first-class props.
:]

from react-tabulator.

ngduc avatar ngduc commented on September 22, 2024

@Austint30 Please let me know if new version works for you. Thanks.

from react-tabulator.

brendonhc avatar brendonhc commented on September 22, 2024

@Austint30 Please let me know if new version works for you. Thanks.

It's worked for me! Thanks!

But, I wanted format my rows with Nested Tables like a: http://tabulator.info/examples/4.0#nested-tables

I got it, but, I had to import Tabulator to make Nested Tables exactly equal tabulator examples:

import Tabulator from "tabulator-tables"; //import Tabulator library
import "tabulator-tables/dist/css/tabulator.min.css"; //import Tabulator stylesheet

My ReactTabulator looks like this:

<ReactTabulator
    ref={ref => (this.ref = ref)}
    data={this.props.sector.humanresources}
    locale={true}
    columns={[
        {
            title: "Tipo",
            sorter: "string",
            field: "humanresource.name",
            headerSortStartingDir: "desc",
            locale: true,
            headerFilter: false,
            widthGrow: true
        },
        {
            title: "Quantidade",
            field: "quantity.planned",
            editor: "number",
            validator: ["integer", "min:0"]
        },
        {
            formatter: deleteIcon,
            align: "center",
            // documentation: http://tabulator.info/docs/4.2/callbacks#cell
            cellClick: (event, cell) => this.handleHumanResourcesRemove(event, cell)
        }
    ]}
    rowFormatter={
        row => {
            // documentation: http://tabulator.info/examples/4.0#nested-tables
            //create and style holder elements
            var holderEl = document.createElement("div");
            var tableEl = document.createElement("div");

            holderEl.style.boxSizing = "border-box";
            holderEl.style.padding = "10px 30px 10px 10px";
            holderEl.style.borderTop = "1px solid #333";
            holderEl.style.borderBotom = "1px solid #333";
            holderEl.style.background = "#ddd";

            tableEl.style.border = "1px solid #333";

            holderEl.appendChild(tableEl);

            row.getElement().appendChild(tableEl);

            var subTable = new Tabulator(tableEl, {
                layout: "fitColumns",
                data: row.getData().people,
                columns: [
                    { title: "Nome", field: "fullName", sorter: "fullName" },
                    { title: "CPF", field: "documentId" },
                    { title: "Email", field: "email" },
                    { title: "Tel", field: "tel" },
                    {
                        formatter: editIcon,
                        align: "center",
                        cellClick: (event, cell) => this.handleHumanResourcesAddPerson(event, cell)
                    }
                ]
            })

        }}
    dataEdited={data => this.handleHumanResourcesChange(data)}
    layout={"fitColumns"}
    autoResize={true}
    reactiveData={true}
/>

My question is, can I make this with ReactTabulator only? (Without pure Tabulator)
May you make Nested Tables examples?

Thanks in advance!

from react-tabulator.

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.