public function addJsPaginator($ipp, $options = [], $container = null, $scrollRegion = null)
    {
        $this->ipp = $ipp;
        $this->jsPaginator = $this->add(['jsPaginator', 'view' => $container, 'options' => $options]);

        // set initial model limit. can be overwritten by onScroll
        $this->model->setLimit($ipp);

        // add onScroll callback
        $this->jsPaginator->onScroll(function ($p) use ($ipp, $scrollRegion) {
            // set/overwrite model limit
            $this->model->setLimit($ipp, ($p - 1) * $ipp);

            // render this View (it will count rendered records !)
            $json = $this->renderJSON(true, $scrollRegion);

            // if there will be no more pages, then replace message=Success to let JS know that there are no more records
            if ($this->_rendered_rows_count < $ipp) {
                $json = json_decode($json, true);
                $json['message'] = 'Done'; // Done status means - no more requests from JS side
                $json = json_encode($json);
            }

            // return json response
            $this->app->terminate($json);
        });

        return $this;
    }