Giter Club home page Giter Club logo

Comments (4)

nicolaskruchten avatar nicolaskruchten commented on August 16, 2024

You should be able to use the sorters prop to specify the order you want to use for the Tamanho attribute. You can see this in action in the demo here: https://github.com/plotly/react-pivottable/blob/master/examples/App.jsx#L44

from react-pivottable.

fabiokiatkowski avatar fabiokiatkowski commented on August 16, 2024

Yes, I saw this function but I tried with the following code
My Tips is this
["ordemProducao", "tamanho", "cor", "quantidade", "ordenacaoTamanho"], [225185,"G","000001",30,95], [225185,"M","000001",20,90], [225185,"GG","000001",40,100], [225185,"P","000001",60,85], [225185,"XG","000001",50,411]

My State is
this.setState({ mode: "demo", filename: "Sample Dataset: Tips", pivotState: { data: tips, rows: ["cor"], cols: ["tamanho"], aggregatorName: "Integer Sum", vals: ["quantidade"], rendererName: "table", sorters: { "Size": sortAs(tips.slice(1).map(tip => tip[4]).sort((a, b) => a > b))}, plotlyOptions: {width: 900, height: 500} } });
I didn't get the expected behavor (behavor that I expected).

I forked and did some change, passing an object to columns attribute.

from react-pivottable.

nicolaskruchten avatar nicolaskruchten commented on August 16, 2024

In this case, you'll want ...sorters: { "tamanho": sortAs(["P", "M", "G", "GG"]) }...

Basically you're adding a custom sorting rule for the "tamanho" column ("Size" doesn't make sense here, it doesn't refer to anything) and that rule is to sort it in this exact order: P M G GG.

from react-pivottable.

fabiokiatkowski avatar fabiokiatkowski commented on August 16, 2024

ok, I get it. thanks.

from react-pivottable.

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.