I am writing a data tables plugin and am currently working on the index page in the CP.
I've followed the instructions here:
index.twig
{% extends '_layouts/elementindex' %}
{% set title = "DataTables"|t('app') %}
{% set elementType = 'matfish\\DataTables\\elements\\DataTable' %}
{% block actionButton %}
<div id="extra-headers">
<div class="buttons right">
<a href="{{ url('datatables/tables/new') }}" class="btn submit add icon">
{{ "New DataTable"|t('datatables')}}
</a>
</div>
</div>
{% endblock %}
Page is rendered but the table area is empty:
Table Attributes are defined on element class, and are displayed in dropdown:
protected static function defineTableAttributes(): array
{
return [
'title' => \Craft::t('app', 'Title'),
'elementType' => \Craft::t('datatables', 'Element Type'),
'fields' => \Craft::t('datatables', 'Fields'),
];
}
When I compared to other index pages I noticed that the ajax calls that are used to get the data and render the table are not fired:
index.php?p=admin/actions/element-indexes/get-elements&v=163847
index.php?p=admin/actions/element-indexes/count-elements&v=1638471423198
There are no JS errors in the console.
Edit 19-11-2022: Plugin ready at https://plugins.craftcms.com/tablecloth?craft4