diff --git a/app/Entity/Book.php b/app/Entity/Book.php
index 0c7b2ccf..324824ed 100644
--- a/app/Entity/Book.php
+++ b/app/Entity/Book.php
@@ -36,6 +36,10 @@
new Create(),
new Update(),
new Index(grid: BookGrid::class),
+ new Index(
+ template: '@SyliusAdminUi/crud/index.html.twig',
+ shortName: 'withoutGrid',
+ ),
new Delete(),
new BulkDelete(),
new Show(),
diff --git a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/data_table.html.twig b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/data_table.html.twig
index 0ef4a3e6..ea2a7efa 100644
--- a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/data_table.html.twig
+++ b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/data_table.html.twig
@@ -2,8 +2,8 @@
{% import '@SyliusBootstrapAdminUi/shared/helper/pagination.html.twig' as pagination %}
{% set resources = hookable_metadata.context.resources %}
-{% set data = resources.data %}
-{% set definition = resources.definition %}
+{% set data = resources.data|default([]) %}
+{% set definition = resources.definition|default(null) %}
{% if data|length > 0 %}
diff --git a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/filters.html.twig b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/filters.html.twig
index 0e52b5cd..079bdb90 100644
--- a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/filters.html.twig
+++ b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/filters.html.twig
@@ -6,7 +6,7 @@
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.all('_route_params')) %}
{% set are_criteria_set = app.request.query.has('criteria') %}
-{% if resources.definition.enabledFilters is not empty %}
+{% if resources.definition.enabledFilters|default([]) is not empty %}
{% set content %}
diff --git a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/no_results.html.twig b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/no_results.html.twig
index 3214bcaf..d8b77b8b 100644
--- a/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/no_results.html.twig
+++ b/src/BootstrapAdminUi/templates/shared/crud/index/content/grid/no_results.html.twig
@@ -1,6 +1,6 @@
{% set resources = hookable_metadata.context.resources %}
-{% if resources.data|length == 0 %}
+{% if resources.data is defined and resources.data|length == 0 %}
{% hook 'no_results' %}
diff --git a/tests/Functional/BookTest.php b/tests/Functional/BookTest.php
index 160a0fdb..576365dc 100644
--- a/tests/Functional/BookTest.php
+++ b/tests/Functional/BookTest.php
@@ -98,6 +98,28 @@ public function testBrowsingBooks(): void
self::assertSelectorExists('tr.item:last-child [data-bs-title=Delete]');
}
+ public function testBrowsingBooksWithoutGrid(): void
+ {
+ BookFactory::new()
+ ->withTitle('The Shining')
+ ->withAuthorName('Stephen King')
+ ->create()
+ ;
+
+ BookFactory::new()
+ ->withTitle('Carrie')
+ ->withAuthorName('Stephen King')
+ ->create()
+ ;
+
+ $this->client->request('GET', '/admin/books/withoutGrid');
+
+ self::assertResponseIsSuccessful();
+
+ // Validate Header
+ self::assertSelectorTextContains('[data-test-page-title]', 'Books');
+ }
+
public function testSortingBooks(): void
{
BookFactory::new()