Doubts about data table
-
Hello,
I think the documentation of DataTable is missing some features. I searched across the forum, and looks like people know how to do this things, but nobody says how:
- How can I set a column as sticky ?
- How can I add a column with controls for every row ? I don’t want to add an extra property to my objects just to be able to customize this row
- How can I customize columns programmatically ? The q-td component forces you to define the column name beforehand. I want to define which cells should be customized based on the type: date ? object ? array ?
Thanks in advance
-
-
Hello @benoitranque
Thank for your answers. Regarding poing one, I saw several issues about sticky columns, so it should be possible. Here is a guide about making them look prettier:
http://forum.quasar-framework.org/topic/889/qdatatable-sticky-column-style-enhancement/2Regarding controls I was fearing an answer like that. To be honest, adding a property to my data just to be able to render a control column does not look like something clean to me. Just adding the column is not enough, you must add the actual field to the results.
I thought about using the selection slot, but I am unable to target such slot. Do you know where can I check which slots are available ? I triedbody-cell-selecction
col-selection
and some other combinations. Some documentation about that would be valuable.Regarding the third, I came to that conclusion too. But you don’t have to render the full body, you can use
body-cell
slot and save yourself some iteration logic.Thanks and regards
-
@danielo515 said in Doubts about data table:
Regarding controls I was fearing an answer like that. To be honest, adding a property to my data just to be able to render a control column does not look like something clean to me. Just adding the column is not enough, you must add the actual field to the results.
That is just not true. You can just add a column to the list of columns and it will be rendered, even that prop does not exist on your data. My mistake here was that I was not including it on the list of visible columns
-
I summarized my findings here:
http://forum.quasar-framework.org/topic/1877/datatable-small-tips -
@danielo515 said in Doubts about data table:
Hello @benoitranque
Thank for your answers. Regarding poing one, I saw several issues about sticky columns, so it should be possible. Here is a guide about making them look prettier:
http://forum.quasar-framework.org/topic/889/qdatatable-sticky-column-style-enhancement/2Regarding controls I was fearing an answer like that. To be honest, adding a property to my data just to be able to render a control column does not look like something clean to me. Just adding the column is not enough, you must add the actual field to the results.
I thought about using the selection slot, but I am unable to target such slot. Do you know where can I check which slots are available ? I triedbody-cell-selecction
col-selection
and some other combinations. Some documentation about that would be valuable.Regarding the third, I came to that conclusion too. But you don’t have to render the full body, you can use
body-cell
slot and save yourself some iteration logic.Thanks and regards
There no longer is a “selection” slot. Use the selected.sync prop instead