Creating and updating backend partials

Hi there,

I am building a backend interface for a custom plugin. It will show statistics and also have some option dropdowns and buttons to allow the user to select the data to display.

This is easy for me to do in the frontend, but I am not sure how to do this in the backend. Specifically, do I need to use partials to display the statistics and then use AJAX to update them, same as I would in the frontend? If so, is there any examples or documentation for this.

Currently, in the backend controllers, I have set up a Statistics class with a function index(). This can be used to get data from my models and outputs the data in Statistics/index.htm.

Within Statistics/index.htm I can add a button that calls a method:


and I place the function onChangedata() in my statics class, and it is called. However I can get the data on the page to update, so I figure I need a partial to reference and update.

Would be grateful for any help on this

do you tried data-request-update="partialName: '#container-id'" ?


Thanks, yes that worked. Obvious really!!

But I wasn’t even sure how to add the partial properly, but then found another plugin to reference of this:

<?= $this->makePartial('partialfilename'); ?>

Thanks for the help.

Have since found more information here:

1 Like