Open Closed

Custom Code in Blazor razor componets #5999


User avatar
0
mina created

I can see several locations where we can add custom code but not one of them outside of the current structure, for example we need to add another Entity Action(this is done as it has a placeholder for custom code) but we need it to open addition modal, where should we place that modal?


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You need to customize the Blazor component page.

    https://docs.abp.io/en/abp/latest/UI/Blazor/Customization-Overriding-Components?UI=Blazor#overriding-a-razor-component

  • User Avatar
    0
    mina created

    Hi,

    We have some question as follow:

    1- if we are overide a page like adding extra Modal to ABP generated page, Should we replace the full razor and razor. cs or just add just the needed Modal / function?

    2- Also when to use the new abp suite code hooks and when to use this?

    3-Is there a documentation for the Code Hooks new feature?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can check this: https://blog.abp.io/abp/ABP.IO-Platform-7-4-RC-Has-Been-Published

  • User Avatar
    0
    mina created

    Hello liangshiwei,

    We are still a little bit confused and have some issues with ABP code hooks.

    1- We are expecting to change the suite custom code hooks tags in the desired place but it seems not working, is that the intended solution, or this will be fixed?

    2- For the other provided solution, I mean overriding the full page, it worked but we have to change the routing at @page as it will conflict with the original page generated by ABP SUIT.

    Also for the c#

    1- If we added a new method in the Partial IXRespository.Extended, and try to add the implementation in the EfCoreXRepository (Eteneded), The EfCoreXRepositoryBase abstract refuses to accept it as an implementation and we have to move it in the abstract class EfCoreXRepository (Base) which again we will remove in case of regeneration.

    2- The same if we added a method in IXAppService Extended class, where should we implement it in the controller as it is regenerated each it we regenerate the entity

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    1- We are expecting to change the suite custom code hooks tags in the desired place but it seems not working, is that the intended solution, or this will be fixed?

    Can you provide the full steps to reproduce? we will check it.

    2- For the other provided solution, I mean overriding the full page, it worked but we have to change the routing at @page as it will conflict with the original page generated by ABP SUIT.

    The solution is to custom the module pages, you should use the custom code hooks.

    1- If we added a new method in the Partial IXRespository.Extended, and try to add the implementation in the EfCoreXRepository (Eteneded), The EfCoreXRepositoryBase abstract refuses to accept it as an implementation and we have to move it in the abstract class EfCoreXRepository (Base) which again we will remove in case of regeneration. 2- The same if we added a method in IXAppService Extended class, where should we implement it in the controller as it is regenerated each it we regenerate the entity

    we will check it. this may be a problem

  • User Avatar
    0
    mina created

    1- below is the autogenerated Edit modal by ABPSuite., it offers several Hooks at different locations, however, we need to add our Modal in a different place as none of the offered places are appropriate

    <Modal @ref="EditBillingCycleStatusModal" Closing="@EditBillingCycleStatusModal.CancelClosingModalWhenFocusLost"> <ModalContent Centered="true"> @//<suite-custom-code-block-8>@ @//</suite-custom-code-block-8>@ .......

    @//<suite-custom-code-block-10>@ @//</suite-custom-code-block-10>@ </ModalContent> </Modal>

    what we need is to to be able to add a Hook After the modal to add our new Modal as below:

    <Modal @ref="EditBillingCycleStatusModal" Closing="@EditBillingCycleStatusModal.CancelClosingModalWhenFocusLost"> <ModalContent Centered="true"> @//<suite-custom-code-block-8>@ @//</suite-custom-code-block-8>@ .......

    @//<suite-custom-code-block-10>@ @//</suite-custom-code-block-10>@ </ModalContent> </Modal>

    @//<suite-custom-code-block-11>@

    <h1>new Model</h1> @//</suite-custom-code-block-11>@

    what is the right solution to do that?

    3- Waiting for your feedback regarding the service sides part

    Thanks, Mina.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can confirm it. this is a problem with the suite. we will improve the suite in the next patch version. your ticket was refunded.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07