Closed fractal3000 closed 3 months ago
Tested on: 1) Jmix version: 2.3.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6682-233 IntelliJ version: IntelliJ IDEA 2023.3.7 (Community Edition) 2) Jmix version: 2.3.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6696-241 IntelliJ version: IntelliJ IDEA 2024.1.4 (Community Edition) 3) Jmix version: 2.3.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6697-242 IntelliJ version: IntelliJ IDEA 2024.2 (Community Edition)
setClassNameGenerator is not available, setPartNameGenerator is present – Ok.
Currently there are two ways for dinamic styling DataGrid cells and rows in 2.x version of Jmix. First one is using setClassNameGenerator method. Second one is using setPartNameGenerator method.
Both methods are inherited from Vaadin Grid component. The case of using setPartNameGenerator method is described in Vaadin documentation(see link below) but case of using setClassNameGenerator is not described at all. https://vaadin.com/docs/latest/components/grid/styling#part-name-generator
Futhermore the case of using setClassNameGenerator is more complicated than using setPartNameGenerator because elements of cells are slotted elements in shadow DOM tree. Seems that using class names is not recommended way(there are no any details or examles in vaading documentation). There is an issue for Vaadin(link below) that confirms such opinion. https://github.com/vaadin/flow-components/issues/5186
Suggestion is to hide method setClassNameGenerator from palette and make it deprecated. In other hand add examples of using class name generator to our samples' site and maybe to Jmix documentation.
Information about partNameGenerator is absend in our documentation(link below) so it shoud be added. https://docs.jmix.io/jmix/2.2/flow-ui/vc/components/dataGrid.html#classNameGenerator