Hi, I have a table component, I want the fields of the table can be editable or not by pressing a checkbox that the user selects, I created a code that I see runs well but when I do not see the results, the table follows Without being able to edit, it may not be refreshing. How could I get it ?.
I am enclosing the code:
checkBox_EditarTodos.addValueChangeListener(e -> {
//si marco el check dejo editar todos los campos
if (Boolean.TRUE.equals(e.getValue())) {
List<Table.Column> columnList = table_AnalisisDsecciones.getColumns();
for (Table.Column c : columnList) {
c.setEditable(true);
}
table_AnalisisDsecciones.repaint();
} else {
//simpre hay dos campos editables que son los de valor de inventario
List<Table.Column> columnList = table_AnalisisDsecciones.getColumns();
for (Table.Column c : columnList) {
c.setEditable(false);
}
table_AnalisisDsecciones.repaint();
}
});
The column’s editable attribute is applicable only if the corresponding table also has the editable=true attribute. Did you set the table to be editable?
Hi Gleb, I attach the .xml of the screen and I put the controller, also attached an image of the screen to make it clearer, when clicking on the checkbox all the fields in the table have to be editable.
I found that editable attribute cannot be changed for columns during runtime. I’ve created an issue.
For now, I would recommend setting editable=“true” to all necessary columns declaratively and change Table’s editable attribute in runtime.
Regards,
Gleb