Add, remove buttons for the table

Hello,

I have added add, remove actions and based on from where i call it, i set the visibility to true or false.

But the buttons are visible no matter if the visible property is set to false in the xml page.

<actions>
   <action id="add"
            openType="NEW_TAB"/>
    <action id="remove"/>
</actions>
<buttonsPanel id="buttonsPanel"
              alwaysVisible="false">
    <button id="addBtn"
            action="actualValuesTable.add"
            visible="false"/>
    <button id="removeBtn"
            action="actualValuesTable.remove"
            visible="false"/>
</buttonsPanel>

And in the java file i have this code:

@Override
public void init(Map<String, Object> params) {
    super.init(params);

    if (something) {
        addBtn.setVisible(true);
        removeBtn.setVisible(true);
    }
}

Am i missing something here? The buttons are always visible, need to hide them and show them only when some condition is met.

Regards,
Adnan

Hi,

If an Action instance is defined for a Button, the button will take the following properties from it: caption, description, icon, enable, visible. caption and description properties will be imported from Action only if they are not set in the Button itself. All other listed Action properties have priority over the Button properties. If Action properties are changed after the Action is set for a Button, then Button properties also change accordingly, i.e. the button listens to the changes in Action properties. In this case, the caption and description properties will change even if they were initially assigned to the button itself.

See the doc.

Regards,
Gleb

Hello,

Thank you so much. It works now.

Regards,
Adnan