Extend a component

Hello,
I should extend the Table component to add new small features to the table (es. loss of focus after editing) but I don’t understand how it is possible to do it. Can I have a small example?
Thanks a lot

Hi,

In simple case, you need to extend the Table component class and register a new component. To do so, create the cuba-ui-component.xml file in the web module with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<components xmlns="http://schemas.haulmont.com/cuba/components.xsd">
    <component>
        <name>table</name>
        <class>com.company.demo.web.gui.components.MyCustomTable</class>
    </component>
</components>

See docs for more detail.

Regards,
Gleb

Sorry Gleb, :sweat_smile:
i don’t have the gui folder,i have to create it?for extend table i have to create the interface, the loader etc how is described in the documentation?

It’s just a sample package. You may have any package you want in the web module. As for Loader, it’s optional and needed only if you want to provide custom attributes for the component. Interface is needed for a newly created component, in case of extending you already have one.