How Can we render a component on action of controller?


I’m trying to render an component from action of controller. Actually, I want to render component after button click event. I don’t want to do show/hide thing. I want actual rendering of component after button clicked. Is there any way to do this?

Currently, I’m calling an action on button click and able to change data of component by changing variable values in action but I want to render component, only after clicking on button.


How is what you want to do different from showing or hiding the component template?

Showing and hiding can be done by CSS. But I’m using AJAX to show data. I want AJAX whenever user clicks on button. I can show/hide elements if component on button is clicked. But I just want that AJAX will not call until button is clicked.

I explain further. I’ve a html table which is in component which shows data by AJAX call. And appears on page load which is worthless for me and application. I want to call AJAX and show data only after button click. And solution is - Render component after button clicked. One more thing after button click, data gets updated and table is correct. But I want to remove extra AJAX call on page load. So, just need a solution which can help me to Render component on controller action.

The action edit will set isEditing and will render the component like this:

You can handle the action that sets isEditing on your controller.

As @vikram7 said How is what you want to do different from this?

Thanks broerse and vikram7 for you help.