Hide row from UI

Hello Team,

Is there any solution in order to hide a row into a table (from UI not programmatically)?
(Something similar with column collapsed).
However I think to consider a logic + css style…

Best Regards,
-n

Any news here, pls?

If you’re talking about hiding a row from a data grid, you can just remove lines from a data container. Or don’t even load them.

What is the exact case? Do you want to click on a row and hide it?

Could you be more specific please? How can I remove lines from data container?
The user should do this.
Yes click on a row and hide it can be a solution.

The case: let say I have a record that is not necessary anymore after Ia while. Of course I can delete it but I still want to manage it. (I know that I can do it from Admin/Restore Deleted Entities but this is a hard way…)

You want to hide some entities based on an attribute value from all screens, is it correct? Or you want to hide them from one particular screen only?

For the first case, you can just delete the entity. By default, CUBA just marks an entity instance as deleted, so you can restore it if needed. You can add an attribute notNessesary and create a filtering method in a security group, so some users won’t be able to see this entity. And you can set this attribute when a user clicks on a grid row.

If we’re talking about one particular screen, you can override loading process by adding a where condition to screen’s loader JPQL or installing your own data loading handler.

I just don’t get the case - what are you going to achieve?

Hi,

My goal is that a user can hide/unhide a row if he wants (based on an attribute status ).
I just wondered if Cuba has something like that.
It’s just about one particular screen - the second scenario. Your idea sounds good - I can select one row and override loading process after let say, press a special refresh button.

Thank you!
-n

Did you try the built-in generic filter? It’s pretty flexible, you can pre-define some conditions and use them in your screen.

Could you be more specific pls? How can I use it in this case? Let say the user marks some rows… and after that…?

OK, just give me some time to create an example for you.

1 Like

I meant - you can use filter to switch between different views.

image

Please find the example attached. hidden-rows.zip (116.0 KB) On the Filtered Persons screen you can click on Make Secret Agent button and row will be hidden from the UI.

image

But it will be visible in the general Person Browser. The idea is to set a special property, update the entity in the DB and then remove it from the data container to avoid reloading data. In the Filtered Persons screen I set up a where condition in the data loader query to exclude secret agents from the list.

            <loader id="personsDl">
                <query>
                    <![CDATA[select e from hiddenrows_Person e where e.secretAgent <> true]]>
                </query>
            </loader>

Super cool…Thank you!

Is it what you want?

Yes, could be a solution.

1 Like

To be honest I don’t understand very well what:

 @Subscribe
    public void onInit(InitEvent event) {
        filter.setPropertiesFilterPredicate(metaPropertyPath ->
                metaPropertyPath.getMetaProperty().getName().equals("secretAgent"));
    }

does?
It should be selected only checked Secret agents when I open the Browser but doesn’t do that.
image

Also I have this compilation error (at hotdeploy time):
error: package com.company.hiddenrows.entity does not exist
import com.company.hiddenrows.entity.Person;
error: cannot find symbol
public class PersonBrowse extends StandardLookup {

Ooops. Just ignore it. I forgot to delete my experiments with the filter. In fact, this code just removes all available properties from the filter except for “secretAgent”.

As for the compilation error at hot deploy time - it might happen sometimes. I haven’t experienced it with this particular project. If you can reproduce it, please create an issue in CUBA GitHub.

OK. Thank you. :+1:

1 Like