joomlaboat / custom-tables

The Custom Tables extension allows you to create, manage, and display custom data on your Joomla site. It is helpful if you need to display data that is not part of the standard Joomla content structure. For example, you could use this extension to create a custom table for product information, customer data, or any other type of data that you need to display on your site. The Custom Tables is the CRUD solution for Joomla 3.x and 4.x - CREATE, READ, UPDATE and DELETE. You can add tables, fields, and layouts to create catalogs, forms, or details pages. It has 40 Field Types: Integer (numbers), Decimal, Text String, Time, Email, Color, Image, File, User, Language, etc.
https://joomlaboat.com/custom-tables
GNU General Public License v2.0
35 stars 11 forks source link

Add button in List view does not open a new empty edit form #71

Closed mennoswaak closed 3 months ago

mennoswaak commented 6 months ago

Add button in List view does not open a new empty edit form but shows the latest filled record. So no way to add a new record. In Detail view a File field opens a 404 page not found when klicked on it. After (almost?) every update I have to redo the menu items with Custom Tables. The settings are lost. I have close to a hundred menu items.....

My application has been working well for a while. If there is no quick solution for it can I go back to an older stable version?

This is on J4.4.1 om php 8.2.7

joomlaboat commented 6 months ago

Hello Menno, What do you mean by redoing menu items? Some menu item settings not saved, table selected, or layout? J4.4.1 is so much different compared to 4.4.0. I didn't test on PHP 8.2.7 yet.

mennoswaak commented 6 months ago

Hello Ivan Atfter an update of Custom Tables things go wrong in the frontend. If I want to open a list this kind of messages appear:

0 Typed property CustomTables\Layouts::$layoutId must not be accessed before initialization

Call stack -- # | Function | Location 1 | () | JROOT/components/com_customtables/libraries/customtables/views/catalog.php:135 2 | CustomTables\Catalog->render() | JROOT/components/com_customtables/views/catalog/tmpl/default.php:54 3 | include() | JROOT/libraries/src/MVC/View/HtmlView.php:415 4 | Joomla\CMS\MVC\View\HtmlView->loadTemplate() | JROOT/libraries/src/MVC/View/HtmlView.php:203 5 | Joomla\CMS\MVC\View\HtmlView->display() | JROOT/components/com_customtables/views/catalog/view.html.php:68 6 | CustomTablesViewCatalog->renderCatalog() | JROOT/components/com_customtables/views/catalog/view.html.php:39 7 | CustomTablesViewCatalog->display() | JROOT/libraries/src/MVC/Controller/BaseController.php:660 8 | Joomla\CMS\MVC\Controller\BaseController->display() | JROOT/components/com_customtables/controllers/catalog.php:81 9 | require_once() | JROOT/components/com_customtables/controller.php:53 10 | CustomTablesController->display() | JROOT/libraries/src/MVC/Controller/BaseController.php:693 11 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/components/com_customtables/customtables.php:33 12 | require_once() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71 13 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73 14 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:361 15 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/SiteApplication.php:208 16 | Joomla\CMS\Application\SiteApplication->dispatch() | JROOT/libraries/src/Application/SiteApplication.php:249 17 | Joomla\CMS\Application\SiteApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:293 18 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/includes/app.php:61 19 | require_once() | JROOT/index.php:32

So in the backend I go to the corresponding menu item and I can see that under Tables & Layout some of the parameters are set back to - Default insteed of the choices I made there before.

mennoswaak commented 6 months ago

Most urgent for me now is the Add button

joomlaboat commented 6 months ago

Is it possible that the Layout name contains a white space?

joomlaboat commented 6 months ago

What is the link to Add New page? Does it contain listing_id parameter?

mennoswaak commented 6 months ago

There where several Layout names with a white space. I am replacing them now with a underscore.

In the List view layouts I never used any extra parameter. Just {{ html.add }}. This has been working for some time, till.... a update? For my most Urgent situation I changed that into {{ html.add(1948) }}. 1948 is a menu iten ID of an Edit form that I added the menu. And this works. And that is fine for now. But I have a fourty plus more list where I have to change that is this appears to be the one solution. So I realy hope that the trusted old and simple {{ html.add }} will be back in charge here.

Does this information help?

joomlaboat commented 6 months ago

Yes, it helps. One more question: when you use {{ html.add }} tag what link it generates?

Like this?

http://localhost/index.php?option=com_customtables&view=edititem&returnto=aHR0cDovL2xvY2FsaG9zdC9pbmRleC5waHAvdGVzdC1maWVsZHMtMQ==&Itemid=4154

Or are there more parameters in the generated link?

P.S. tested on PHP 8.3.0 - no issues.

mennoswaak commented 6 months ago

https://permacultuur.net/index.php?option=com_customtables&view=edititem&returnto=aHR0cHM6Ly9wZXJtYWN1bHR1dXIubmV0L2luZGV4LnBocC9wY2phYXItNjI4L3Byb2ZpZWxmb3RvLXVwbG9hZC02Mjg/dmlldz1jYXRhbG9n&Itemid=1542

joomlaboat commented 6 months ago

Can you please try the latest (11 Dec) update, if you didn't try it yet?

https://github.com/joomlaboat/custom-tables

mennoswaak commented 6 months ago

no, it does not help

joomlaboat commented 6 months ago

Both {{ html.add(1948) }} and {{ html.add() }}

Generate the same link?

https://permacultuur.net/index.php?option=com_customtables&view=edititem&returnto=aHR0cHM6Ly9wZXJtYWN1bHR1dXIubmV0L2luZGV4LnBocC9wY2phYXItNjI4L3Byb2ZpZWxmb3RvLXVwbG9hZC02Mjg/dmlldz1jYXRhbG9n&Itemid=1948

mennoswaak commented 6 months ago

{{ html.add(1948) }} generates https://permacultuur.net/index.php?option=com_customtables&view=edititem&returnto=aHR0cHM6Ly9wZXJtYWN1bHR1dXIubmV0L2luZGV4LnBocC9wY2phYXItNjQyL3Byb2ZpZWxmb3RvLXVwbG9hZHMtNjQyP3ZpZXc9Y2F0YWxvZw==&Itemid=1948 And 1948 is the ID of a menu item that I made aspecialy to sole my problem. It opens an (empty) Edit Form. This works as needed.

{{ html.add() }} generates https://permacultuur.net/index.php?option=com_customtables&view=edititem&returnto=aHR0cHM6Ly9wZXJtYWN1bHR1dXIubmV0L2luZGV4LnBocC9wY2phYXItNjQyL3Byb2ZpZWxmb3RvLXVwbG9hZHMtNjQyP3ZpZXc9Y2F0YWxvZw==&Itemid=1687 And 1687 is the ID of the List. where {{ html.add() }} is in the layout. But... it open the Edit form with the content of the last addes record.

My feeling is that the gegerated link is missing an extra parameter that makes that the form opens empty.. Maybe a simple 0 at the end??

joomlaboat commented 6 months ago

Do you have a menu item with ID 1687?

The layout with {{ html.add() }} tag is it a Simple Catalog? and the menu type is CustomTables/Records?

Or is it a module?

Is it possible to see it myself?

mennoswaak commented 6 months ago

1687 is the menu item to List where we try to find the solution for. It is Custom Tables >> Records Ans the layout is indeed Simple Catalog

This is the HTML (Desktop) layout that I now use:

Om een nieuwe bodemprofielfoto te uploaden klik je op het oranje plus-icoon

Om je ingevoerde foto met gegevens aan te passen, klik achterin jouw invoerregel op het potlood-icoontje in de kolom Action.

|| {{ html.recordcount }} ||
{{ html.add(1948) }}
{% block record %} {% endblock %}
{{ record.label }} {{ bestandnaam.label }} {{ naamcursist.label(true) }} {{ plaatsnaam.label }} Action
Bekijk {{ record.id }} {{ bestandnaam("","icon-filename-link") }} {{ naamcursist }} {{ plaatsnaam }} {{ html.toolbar("edit") }}

{{ html.pagination }}

{{ html.add(1948) }} is pointing to a menu item that opens an (empty) Edit form that the can now fill a new record in. Actualy it used to be {{ html.add }} and that worked well for some time.

What is the difference between {{ html.add }} and {{ html.add() }} ? The Layout Auto Creator creates {{ html.add }}

joomlaboat commented 6 months ago

{{ html.add }}

If Menu Itemid or Alias is not provided the current page Itemid is used.

Do you have any filter in Menu Item (1687)/Filter Table/ Search Parameter ?

It looks like the problem is with the 1687 menu Item.

joomlaboat commented 4 months ago

Is this issue still exists?