Hey,
I was wondering if it is possible to use the multi-select function on rows for custom made actions. I created a button that users press, and it sets the date of a row to today. But I would like to make it so that users can select multiple rows, and press the button once instead of having to press it multiple times.
Right now I am using the code from one of the demo’s, but this only works for one row. Any suggestions which functions to use to get this to work for multiple rows?
package com.company.machineonderhoud.web.auto;
import com.company.machineonderhoud.entity.Auto;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.core.global.DataManager;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.data.Datasource;
import java.util.Date;
import javax.inject.Inject;
public class AutoBrowse extends AbstractLookup {
@Inject
public Datasource<Auto> autosDs;
@Inject
public DataManager dataManager;
public void onAfronden(Component source) {
Auto selectedAuto = autosDs.getItem();
if (selectedAuto == null) {
showNotification("Selecteer een onderhoudsregel!");
return;
}
Date date = new Date();
selectedAuto.setLaatstOnderhoud(date);
dataManager.commit(selectedAuto);
autosDs.refresh();
showNotification("Klaar!", NotificationType.TRAY);
}
}
Thanks in advance!