Pimcore6: How to overwrite "table.js"

Hi all,

I need your help to overwrite the “table.js” (vendor/pimcore/pimcore/bundles/AdminBundle/Resources/public/js/pimcore/object/tags/table.js).
I would like to delete the following three buttons:


On my table attribute, I can’t set a value for “Rows fixed” cause this value varies according to the products.
I would like to overwrite this file to delete these lines:

if (!this.fieldConfig.rowsFixed || data.length != this.fieldConfig.rows) {
}
AND
tbar.push({
iconCls: “pimcore_icon_empty”,
handler: this.emptyStore.bind(this)
});

Cause I would like that the lines of my table can’t be deleted or added

How can i do that properly ? I can see that the table.js is registred to pimcore.registerNS(“pimcore.object.tags.table”);

If i follow the doc: https://pimcore.com/docs/5.x/Development_Documentation/Extending_Pimcore/Bundle_Developers_Guide/Plugin_Backend_UI.html

I don’t find where to create the file which will overwrite the table.js of the vendor.
Should I create a new file in my custom bundle? or redefine the pimcore.registerNS(“pimcore.object.tags.table”) ?

Thanks in advance for your precious help

Regards,

Benjamin

@zeor59

  1. If you have a custom bundle then create custom javascript file in /var/www/html/project/src/CustomBundle/Resources/public/js/pimcore/custom_table.js
  2. Write like this code :
    pimcore.registerNS(“pimcore.plugin.custom_table”);

Ext.override(pimcore.object.tags.table, {

// copy-paste the core function and modified according to your requirement.
});

3.Include this file path in function getJsPaths()
/var/www/html/project/src/custombundle/custombundle.php

Hope it will help :slight_smile:

1 Like