Is it possible to define the width for a column?
@coderabsolute Use CSS to do that. See here
Thanks for answering that. Maybe, we should document this somewhere which is easily accessible.
Thank you ratiw!
It seems there are not enough css-classes and ids. I can not defined width for columns with a cutting text for cells with long text.
I get incorrect width:
table.vuetable {
width: 1200px;
table-layout: fixed;
}
.vuetable-body > tr > td {
white-space: nowrap;
overflow: hidden; /* cutting log text */
text-overflow: ellipsis; /* adding dots */
}
/*
* Column width
*/
.vuetable th#__checkbox {
width: 15px;
}
.vuetable th#__sequence {
width: 15px;
}
.vuetable th#_name {
width: 120px;
}
.vuetable th#_email {
width: 120px;
}
.vuetable th#_birthday {
width: 80px;
}
.vuetable th#_address {
width: 200px;
}
.vuetable th#_gender {
width: 80px;
}
.vuetable th#_salary {
width: 130px;
}
.vuetable .vuetable-th-slot-actions text-center {
width: 70px;
}
@itelmenko Inspect it from the browser's devtool. The example is from first version of Vuetable. Vuetable-2 is different and has a lot more.
@ratiw I have inspected already. But for "table-layout: fixed;" browser uses first row's cells (not TH) for calculation width of each column...
I tried some settings, but I can not define width of columns if cells has long text.
Also table changes its width when I click sorting or paging.
@itelmenko I'm not very good at CSS. I just know enough to work with it. For the "table-layout: fixed", can you suggest what would make it work?
The <td> for special fields, already has a class marked for its use.
__sequence has vuetable-sequence class__checkbox has vuetable-checkboxes classFor other fields, you could use dataClass option in field definition to define any class you like.
@ratiw, please, try to define width for columns in px (not in percents). And you will see the problem.
Long text must be cut by width of column. But it (width in px + long text) does not work for vuetable-2.
But it works fine in jqGrid.
Please, let me know if you need more details.
Thanks!
@ratiw, sorry for delay. Can you add field with long text (about 200-300 symbols) in https://vuetable.ratiw.net/api/users ?
Because this issue is for long text fields.
You can add some static text and start from there. https://jsfiddle.net/wzk251aq/9/
@cristijora, thank you for your jsfiddle
@ratiw , yes, look like it was my mistake. It works fine on jsfiddle https://jsfiddle.net/itelmenko/no35z5kw/1/
I need to debug my code.
Thank your for help!
Most helpful comment
@coderabsolute Use CSS to do that. See here