View fields not working correctly after more fields and more conditional JavaScript were added #203
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#203
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Ajax opens nothing,
custom document script opens nothing,
custom view script opens jview legacy display,
custom JViewLegacy display opens a textarea below custom JViewLegacy methods
custom JViewLegacy methods opens custom document script
Expected result
less wierdness
Actual result
wierdness
System information (as much as possible)
Additional comments
Please review issue 202
You will basically need to clear your browser history, since it still loads the old JavaScript.
But hey there is your field to add the JavaScript to a file 👍 instead of the document method.
I have had this issue many times, where I add new fields to a page and also new JavaScript to control the field behavior. But then other will have to clear their browser history before things work. Not sure what I can do to prevent that from happening.
Any ideas?
Yes, $doc->addScriptVersion() should fix that permanently.
Hmmm it says
So we can add the attributes and options right in the addScript method. Okay that much I can understand, but how to do the versioning automatically via JCB...
What we have now, is it adds a file, here is an example.
First in the model:
Then in the view on two places, first:
Second:
These are the areas that must be fixed
That means we need to on line 200 in the view do something like this:
With signature we have the following:
Any ideas? We have a file version in the compiler, but it is not always used by the developer as it is controlled by this switch in the Joomla-Component area:
You will see one of the option is:
When a user has it set to that option, the compiler can actually add a view version number, that only changes if the view was updated in JCB.
So I think to add this version number in here.
Can you give me some more explanation on all the other details and what you think we should add in as values, using the admin_view as our example.
addScriptVersion is deprecated? They just added it in 3.2!
Digging deeper......They didn't remove the functionality - they just deprecated a helper method. Joomla still does it, you just have to initiate it in $options.
OK... addScript grabs the version number from.....the $options input....which if null or 'auto' in $this->_scripts[$url]['options']['version'] is autopopulated.
So, $doc->addScript('path/to/script.js',array('version'=>'auto')) should do it.
From there the renderer picks up the version from $document->getMediaVersion().....and I'm not sure where that comes from - but I just tested and this works. I think they take a sum of the installed extension manifests or something. The number is stable until I update an extension (any extension), then it changes.
I say rely on Joomla to handle it. It's how they got past the "clear your cache" instruction between Joomla updates...which, as I recall was around 3.2...
Additional test - the same thing works for addStyleSheet. adding a 'version'='auto' option causes Joomla to add a version sum to CSS links as well.
So far it looks like the version is build by the version class, I am still searching. So when the documents is created in the Factory class:
That does mean the update will be linked to the date and will reload the file basically every time, look here is the generateMediaVersion method that is used in getMediaVersion to build the version hash.
This is not good.
I think we should build our own version generator in the model, and so insure the file only updates if it changes. Should not be to hard, we can use some of their ideas, infact we can even try to use the Version class.
Okay so here it is actually explained.
The media version is renewed after Joomla core update, install, discover_install and uninstallation.
Hmmm am I missing something here? or does that mean only if the core is changed does that string change.
Okay so I still think we should do our own versioning but use some of their tricks to make it easy.
I read that as any install operation....that covers all that I can think of. Discover installs occur when you build an extension in place and then ask joomla to discover it.
So any component being installed resets it?
Are you sure? let me take a look in the component manager.
Okay this is the command used to reset the string
and it is used in the Installer class, so you are right. Okay then it is fine, we can use auto 👍