site view model is generated as admin Model #597

Closed
opened 2020-09-08 16:10:45 +00:00 by studio16 · 4 comments
studio16 commented 2020-09-08 16:10:45 +00:00 (Migrated from github.com)

For some strange reason the dynamic getitem used for a site view doesn't return $this->item data.
I checked the model and the site view model is the same as the admin model for this view which can't be right
class
extends JModelAdmin
should be
extends JModelItem

how can this happen?

For some strange reason the dynamic getitem used for a site view doesn't return $this->item data. I checked the model and the site view model is the same as the admin model for this view which can't be right class extends JModelAdmin should be extends JModelItem how can this happen?
studio16 commented 2020-09-08 16:11:40 +00:00 (Migrated from github.com)

compared it to the demo component, looks similar in terms of settings. What am i missing?

compared it to the demo component, looks similar in terms of settings. What am i missing?
studio16 commented 2020-09-09 13:31:12 +00:00 (Migrated from github.com)

To specify what i did so far:

  • created some fields
  • added a admin view (list and item edit) and linked those fields to the admin view
    Backend works fine
  • added 2 dynamic gets to use for the site views: getItem (item view) + getListQuery (list view)
  • created 2 site views and selected for each the appropriate dynamic gets
    saved all, compiled teh componet.
    Front-end list view works fine, item view not so much, all data is empty.
    Than I checked the model and it apperead that the item model has the extends JModelAdmin instead of the extends JModelItem.

Any push into the right direction would be appreciated.

To specify what i did so far: - created some fields - added a admin view (list and item edit) and linked those fields to the admin view Backend works fine - added 2 dynamic gets to use for the site views: getItem (item view) + getListQuery (list view) - created 2 site views and selected for each the appropriate dynamic gets saved all, compiled teh componet. Front-end list view works fine, item view not so much, all data is empty. Than I checked the model and it apperead that the item model has the extends JModelAdmin instead of the extends JModelItem. Any push into the right direction would be appreciated.

There is an issue in JCB, which you should check to see if this is what happened.

This is the issue:
When you in the admin area have an admin_view = hello you should not create a site view with the name hello since should you add this admin view to the front of the website by checking this box to Add:
image

This will cause a conflict since JCB will not check for this, and and will be trying to both add the admin view to the front of the website as well as building the site view with the same name.

I clearly need to improve this, but this is usually the cause of these kind of errors.

There is an issue in JCB, which you should check to see if this is what happened. This is the issue: When you in the admin area have an admin_view = `hello` you should not create a site view with the name `hello` since should you add this admin view to the front of the website by checking this box to **Add**: ![image](https://user-images.githubusercontent.com/5607939/92675875-baff0680-f320-11ea-9933-77daedb95137.png) This will cause a conflict since JCB will not check for this, and and will be trying to both add the admin view to the front of the website as well as building the site view with the same name. I clearly need to improve this, but this is usually the cause of these kind of errors.
studio16 commented 2020-09-10 13:44:44 +00:00 (Migrated from github.com)

Ok i have 2 options than, rename the single item frontend name or leave this field to NONE at least on first compilation. Therefor in this case i make a new admin view and compile it again. I made a test with that and works also.
Thanks for the quick respons.

Ok i have 2 options than, rename the single item frontend name or leave this field to NONE at least on first compilation. Therefor in this case i make a new admin view and compile it again. I made a test with that and works also. Thanks for the quick respons.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#597
No description provided.