When creating a new Controller Behavior class by overriding the ImportExportController behavior, and navigating to the export URL,, this exception shows up:
The partial '_container_export.htm' is not found.
[2020-07-08 05:24:09] development.ERROR: October\Rain\Exception\SystemException: The partial '_container_export.htm' is not found. in /Users/christophevidal/Sites/oc-sttelemedia/modules/system/Traits/ViewMaker.php:91
Stack trace:
#0 /Users/christophevidal/Sites/oc-sttelemedia/modules/backend/Behaviors/ImportExportController.php(688): Backend\Classes\ControllerBehavior->makePartial('_container_expo...', Array)
#1 /Users/christophevidal/Sites/oc-sttelemedia/modules/backend/Behaviors/ImportExportController.php(492): Backend\Behaviors\ImportExportController->importExportMakePartial('container_expor...')
#2 [internal function]: Backend\Behaviors\ImportExportController->exportRender()
#3 /Users/christophevidal/Sites/oc-sttelemedia/vendor/october/rain/src/Extension/ExtendableTrait.php(411): call_user_func_array(Array, Array)
my new controller looks like
Class ExportSelected extends ImportExportController
{
/**
* Behavior constructor
* @param Backend\Classes\Controller $controller
*/
public function __construct($controller)
{
parent::__construct($controller);
}
public function index_onExportSelected()
{
}
}
@chrisvidal why are you extending the behavior instead of just overriding the methods?
not sure to understand the question.
I want to make this behavior class available in my other projects.
When I had the same challenge, I used this constructor for change partials path:
public function __construct($controller)
{
parent::__construct($controller);
$this->viewPath = $this->guessViewPathFrom(\Backend\Behaviors\ImportExportController::class, '/partials');
$this->assetPath = $this->guessViewPathFrom(\Backend\Behaviors\ImportExportController::class, '/assets', true);
}
@chrisvidal I still don't understand your use case, but @Rike-cz has the correct fix for your current issue.
@LukeTowers
I am creating a new behavior inheriting from the existing ImportExporController because I want to add a missing functionality which is the ability to export selected rows from a backend list, instead of using the export form.
@Rike-cz thanks a lot. Let me try this.