Giter VIP home page Giter VIP logo

elm-sortable-table's People

Contributors

augustin82 avatar billstclair avatar davcamer avatar dela3499 avatar derekdreery avatar evancz avatar jephron avatar markfarmiloe avatar matthiaswinkelmann avatar tim-bezhashvyly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elm-sortable-table's Issues

Examples file naming

Hi again,

When building the examples, Elm (0.19.1) complains about the files not starting with a capital letter. Eg. I had to change 1-presidents.elm to Presidents.elm

Request: add ID to Column and use it sort criteria rather than column name

Hi, and first of all thanks for the nice library :)

I've run into a slight issue related to sorting when supporting several locales:

I want to create a sortable table that is also paginated so whenever the sorting changes I want to use the getSortState function to get the (<name>, <is-reversed>) pair and then make a request to a backend /some-resource?sort=<property-id>, where <name> maps to some <property-id>.

Now if my app only supported one language it would be easy as I could simply have a static mapping between <name> and <property-id>, however my app supports ~10 different languages so doing this mapping from the display name, <name>, seems rather inelegant for each language. So I wanted to know if it would be possible to introduce a id property to each column that is then used for sorting as this would decouple the display name, <name>, from being the one used to identify the column?

Hope the above makes sense, and let me know if this is something you would consider implementing and if so whether you prefer to do it yourself or accept a pull request.

Allow reversed initial sort

I have a table with a date column that I wish to display initially in descending order. This is not possible because the initialSort function only allows initial data to be sorted in ascending order.

Relevant issue from original library: evancz/elm-sortable-table#9

I believe extending the initialSort function to accept either a Bool, Sorter or a new Order type would be ideal.

Thanks for maintaining this nifty little library!

Inspectable state to allow for inclusion in URLs?

I have a search results page built in Elm where I'd like to encode as much state in to the URL as possible, so that URLs can be passed through Slack, JIRA tickets, et cetera and the receiver will see the same results as the sender.

The page uses this package to build a sortable table of results, and inkuzmin/elm-multiselect to let the user select the columns to show in the table.

(Table.Config is not stored in the Model, as directed in the README, instead the config is assembled by filtering a list of all possible columns against the selection in the multiselect control.)

The multiselect control has functions to get the selected values and set the selected values. I have used that to integrate the selected columns with the URL: a selection change triggers a URL change, and a URL change can cause a selection change.

Would you be open to the addition of similar functions to this package?

I would picture them being something like:

getSortState : State -> (String, Bool)

sortBy : String -> Bool -> State

or maybe

sortedColumn : State -> String
isReversed : State -> Bool

sortBy : String -> Bool -> State

Another option is to expose the constructor for the State type, which would allow code to destructure the type:

case state of
    State column reversed ->
        ...

But, I think this last option is less interesting because it couples clients more tightly to the current structure of State. I prefer the middle option, with separate functions for the column and the reversed state. Avoiding the tupled return value seems nice.

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.