-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Title/field headings #365
Comments
I second that. It would be great If anyone would have a simple solution for that. |
You should be able to provide both a const datatable = new DataTable("#demo-table", {
data: {
headings: [{text: 'Year of birth', data: 'birthyear'}, {text: 'Eye color', data: 'eyecolor'}],
data: [
['1984', 'brown'],
['2002', 'blue]
]
}
} But I am not sure what the idea is with having it there. You don't address columns with the field name, so what are you trying to achieve? Please provide a minimal example to explain yourself. |
A simple example: Here is an code example (with setting the headers).
So the only solution right now is to use 'date_created' as the table header
|
@Daniel123454321 I see. Yes, that makes sense. I added a fix to make it work and added an example to show how to load both initial and additonal json data after load for this case. I hope that helps. |
Great, thank you very much! |
Is your feature request related to a problem? Please describe.
My request is related to a behavioral bug, I cannot display labels at the top of my table (headings) which are different from the names of the fields in my rows,
My data comes from API, there are compound field names like firstName or birthDate
What to do if I want to display custom labels or show then in different language without using a translation process.
Describe the solution you'd like
Like other plugins accept more options for headings like
headings : [ { field : "string", title : "string", class : "css classes" //.... }, { field : "string2", title : "string2", class : "css classes 2" //.... } ]
Describe alternatives you've considered
I use a key value dictionary object to replace the base array
const titles = fields.map(field => TITLES[field]);
const obj = { headings: titles, data: [] } ...
Additional context
None
The text was updated successfully, but these errors were encountered: