Reusable component > Accessing Inherited Data Model

Hello,

I’m working with a “Reusable Component” that needs to receive data from its parent component. I see that handlers such as “Styles Logic” , allow to bind properties directly from the “Inherited Data Model” without any issues.

However, when working with “event handlers” like “On Click Event”, the “Inherited Data Model” is not available, only Page Data, App Data, and Layout Data are accessible.

Could you guide me on how to access the “Inherited Data Model” within an event handler using Codeless? Or, if that’s not possible, how can this be done using JavaScript as a workaround?

Thanks in advance for your help!

Best regards,
Manuel

You could set this data model into Page/App Data from the place where you have access to it, and after that get it where you need it.

Hello @Dima,

I’m using a “Reusable Component” multiple times on the same page, and each instance needs to have a different “Inherited Data Model”. However, I can’t access this data inside event handlers like “On Click Event”.

Storing it in “Page Data” or “App Data” is not a solution because each instance needs its own separate data.

How can I access the “Inherited Data Model” while keeping each instance independent?

Thanks!

Regards,
Manuel

Are you Icon Button located inside container that use “Inherited Data Model”?
Asking because that what i see when trying to reproduce your issue:

Also share please app id, container and page name where your issue is reproduced. If it required additional actions like login, please create test one for us.

Hello again,

Just found this topic of 2023 which is exactly what i´m talking about:

Seems Alex was able to find a workaround, but i don´t fully understand how to implement it. I enable the data container in a block of the reusable component but then… Could you please explain step by step what i need to do in the reusable component and in the page parent container (origin of the inherited data model)?

Thank you.

Regards,
Manuel

Hello again,

I´ve created an example where 2 different blocks use the same reusable component in order to perform a simple math operation. The idea is for the reusable component consider the input provided in its parent block (deta container enabled). Could you please help solve this puzzle? :slight_smile:

App ID: FA2ABF23-7044-4D7F-8E44-EEAC061C1641
Page: TestReusableComponent
Reusabel Component: RCMultiply

Thank you @Dima.

Regards,
Manuel

Hello @Manuel_Germano

I fix your test page, but this fix is like a ‘hack’ and is not expected behavior for me.
I will ask somebody to find better solution. Do not delete the test page pls


Regards

OK @viktor.liablin.
Many thanks!
Regards,
Manuel