Cascaded Dropdown for Table View

Hi,
I am new to Cuba Platform.
Is it possible to use Cascaded drop-down in Editable Table view in Cuba Application?
I saw the example for edit view.
Is there a any example like this for Editable Table View?

1 Like

Hello,

Do you mean drop-downs with a dependent content in editable table columns?

Yes, I meant a drop-down with dependent content in editable table columns would help me.

We are planning to re-write an application from native Application written in c++ Builder using Oracle Database and using Crystal Report as the reporting Solution.
We are planning to change the front-end of this application to use Cuba Platform for the front-end development.
I foresee we can handle almost everything we did in C++ with only one exception in which we have a typical entry screen in editable table ( Excel Like ) for the scenario like:
I have multiple donors and many projects.

I have materials donated by donors in different projects.

from warehouse, materials are sent to the site where we have civil construction as well as electric construction for electricity distribution.

We need to trace materials in editable table view like:

We need drop down for Project,donors and materials

When we select Project_code from Project drop down, Items in donors drop down should show only donor Code of the selected project.

When donor is selected, items in Materials drop down should show only item_code of the materials donated by selected donors in the selected project.

Hi,

You can easily create drop-downs with a dependent content using generated columns. For example:


String columnId = "task";
timeEntriesTable.addGeneratedColumn(columnId, entity -> {
    // create field for a column
    LookupField lookupField = componentsFactory.createComponent(LookupField.class);
    lookupField.setWidth("100%");
    // get the datasource which contains the provided item
    Datasource<TimeEntry> itemDs = timeEntriesTable.getItemDatasource(entity);
    lookupField.setDatasource(itemDs, columnId);

    // add a property change listener to get notified when 
   // we need to change lookupField options
    itemDs.addItemPropertyChangeListener(e -> {
        if ("project".equals(e.getProperty())) {
            Project project = (Project) e.getValue();
            lookupField.setValue(null);
            // get new set of options according to a new value
            lookupField.setOptionsMap(getProjectTasksMap(project));
        }
    });

    // setup initial values
    Project project = itemDs.getItem().getProject();
    lookupField.setOptionsMap(getProjectTasksMap(project));

    return lookupField;
});

You can read more about generated columns in the documentation. Also, you can visit our Sampler app and see this sample with generated columns.

Iā€™ve prepared a sample project on github. It should help with resolving your problem.

Regards,

Gleb

1 Like

Hi Gleb,

The example was very helpful.
Our development team is very happy with all the features of Cuba Platform.
Thanks for your great help.

Regards,

Nazrul