This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

jvanremoortere
jvanremoortere

The documentation mentions "October's report widget system allows to host the report container on any page, and the container context name is unique. The widget container on the Dashboard page uses the dashboard context."

I want to create a container on (for example) my Companies index (list) page to house some widgets but can't find any working example of this.

Briddle
Briddle

A working example would be nice :)

I added to my controller:

    use Backend\Widgets\ReportContainer;///

    public function index($id=null) 
    {
         $this->asExtension('ListController')->index();
         $this->initReportContainer();
    }

    public function index_onInitReportContainer()
    {
        $this->initReportContainer();
        return ['#dashReportContainer' => $this->widget->reportContainer->render()];
    }

    /**
     * Prepare the report widget used by the dashboard
     * @param Model $model
     * @return void
     */
    protected function initReportContainer()
    {
        new ReportContainer($this, ['context' => 'mycontext'], 'config_dashboard.yaml');
    }

And to my view:

<?= Form::open(['class'=>'layout-relative dashboard-container']) ?>
    <div id="dashReportContainer" class="report-container loading">

        <!-- Loading -->
        <div class="loading-indicator-container">
            <div class="loading-indicator indicator-center">
                <span></span>
                <div><?= e(trans('backend::lang.list.loading')) ?></div>
            </div>
        </div>

    </div>
<?= Form::close() ?>

<script>
    $(document).ready(function() {
        $.request('onInitReportContainer').done(function() {
            $('#dashReportContainer').removeClass('loading')
        })
    })
</script>

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.