GithubHelp home page GithubHelp logo

Comments (7)

tim-bezhashvyly avatar tim-bezhashvyly commented on June 15, 2024

Possible solutions are either adding 2nd argument to initialSort:

initialSort : String -> Bool -> State
initialSort header isReverse =
  State header isReverse

or if you want to avoid BC break adding a new initialReversedSort (or initialSortReversed):

initialReversedSort : String -> State
initialSort header =
  State header True

Please let me know what do you prefer and I will create a PR.

from elm-sortable-table.

2hu12 avatar 2hu12 commented on June 15, 2024

Another possible solution is exposing the State type constructor, like

module Table exposing
  ( ...
  , State(State)
  ...
  )

And we could get the initial state by

model =
  { ...
  , tableState = Table.State "Header" True
  ...
  }

from elm-sortable-table.

ericgj avatar ericgj commented on June 15, 2024

I think you can do this already by defining the column with the decreasingOrIncreasingBy sorter, no?

from elm-sortable-table.

knuton avatar knuton commented on June 15, 2024

I think you can do this already by defining the column with the decreasingOrIncreasingBy sorter, no?

Close, but not quite. The order will be as expected, but the descending/ascending state will be reversed and displayed incorrectly in the UI.

from elm-sortable-table.

BinaryHexer avatar BinaryHexer commented on June 15, 2024

Is there any workaround for enabling this?

from elm-sortable-table.

gaul avatar gaul commented on June 15, 2024

@BinaryHexer You can use a fork by adding the following to elm-package.json:

    "dependency-sources": {
        "evancz/elm-sortable-table": "http://github.com/determined-ai/elm-sortable-table.git"
    },

and the following to package.json in the dependencies stanza:

    "elm-github-install": "1.6.1",

Note that you will need to run yarn run elm-github-install before yarn run elm-make. Finally you should use your own GitHub fork instead of the example one.

from elm-sortable-table.

BinaryHexer avatar BinaryHexer commented on June 15, 2024

@gaul Thanks!

But maybe somebody should start maintaining an alternative version of this on elm-packages, because it seems many PRs are pending on this repository and maybe evanz is too busy (understandably so) to maintain this.

from elm-sortable-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.