Comments (4)
Isn't that something that belongs in the CSS?
from elm-sortable-table.
In my opinion, no. But even if you do want to put it there, you run into the problem that it's hard to write CSS rules to apply to particular header cells, since they aren't classed or otherwise distinguished. You end up with rules like .my-table thead > tr > th:nth-child(0){ }
, .my-table thead > tr > th:nth-child(1){ }
, etc., which is then of course very annoying when you want to insert or move columns around.
from elm-sortable-table.
In other words the underlying issue is how to set attributes on the header cells without having to override the default thead function? This is just a motivating case for that.
A generic solution might be to change the Config type to
type Config data msg :
Config
{ toId : data -> String
, toMsg : State -> msg
, columns : List (Column data msg, List (Attribute msg))
, customizations : Customizations data msg
}
and passing a list of attributes down to the customizations.thead
function instead of just the onClick
(i.e., the onClick
plus the constant attributes supplied by config):
type alias Customizations data msg =
{ tableAttrs : List (Attribute msg)
, caption : Maybe (HtmlDetails msg)
, thead : List (String, Status, List (Attribute msg)) -> HtmlDetails msg
, tfoot : Maybe (HtmlDetails msg)
, tbodyAttrs : List (Attribute msg)
, rowAttrs : data -> List (Attribute msg)
}
Then the public API wouldn't have to change, besides the signature of the thead
function, which is pretty low-level anyway.
from elm-sortable-table.
Having the same problem.
Setting attributes to header cells is a very, very common use case.
Every function that returns a column should take a list f attributes to apply to its th
.
from elm-sortable-table.
Related Issues (20)
- add ability to show/hide columns HOT 1
- Columns with HTML content HOT 1
- Missing tr inside thead HOT 5
- TabBar
- Accessing the sorted rows HOT 2
- Add support for ThAttrs HOT 1
- Table rows are mis-ordered HOT 4
- Wrap row view? HOT 1
- Unsafe column identification HOT 2
- Style table HOT 1
- Custom Sorters
- Pagination HOT 2
- examples in Table.elm link to wrong repo HOT 1
- Dealing with Online Data HOT 3
- Stable sort HOT 4
- Upgrade for 0.19 HOT 1
- Storing the table state in the URL: Make Table.State non-opaque? HOT 1
- Publish 1.0.1? HOT 1
- Allow reversed initial sort HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elm-sortable-table.