Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when trying to load dialogs/sliders #89

Closed
matorodriguez opened this issue Dec 14, 2016 · 37 comments
Closed

Errors when trying to load dialogs/sliders #89

matorodriguez opened this issue Dec 14, 2016 · 37 comments
Assignees
Labels
Milestone

Comments

@matorodriguez
Copy link
Contributor

Since the snapshot 20161124.181023-12 (including release 4.0.1 too), I'm getting errors when trying to load dialogs/sliders.
I used the following browsers:
Chrome: 54.0.2840.99 m (64-bit)
Firefox: 50.0.2

DIALOG
Example:

		<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
		<sj:head locale="es" jquerytheme="start"/>
		<sj:dialog id="mydialog" title="Dialog with local content">
		    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
		</sj:dialog>
Chrome console errors:
  VM408:1 Uncaught TypeError: b.widget is not a function(…)(anonymous function) @ VM408:1(anonymous function) @ VM408:1(anonymous function) @ VM408:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM410:8 Uncaught TypeError: Cannot set property 'position' of undefined(…)(anonymous function) @ VM410:8(anonymous function) @ VM410:12(anonymous function) @ VM410:1(anonymous function) @ VM410:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM413:1 Uncaught TypeError: Cannot read property 'mouse' of undefined(…)(anonymous function) @ VM413:1(anonymous function) @ VM413:1(anonymous function) @ VM413:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM414:1 Uncaught TypeError: Cannot set property 'focusable' of undefined(…)(anonymous function) @ VM414:1(anonymous function) @ VM414:1(anonymous function) @ VM414:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM415:1 Uncaught TypeError: Cannot set property 'keyCode' of undefined(…)(anonymous function) @ VM415:1a.ui.keyCode.BACKSPACE @ VM415:1(anonymous function) @ VM415:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM417:1 Uncaught TypeError: Cannot set property 'safeActiveElement' of undefined(…)(anonymous function) @ VM417:1a.ui.safeActiveElement.b @ VM417:1(anonymous function) @ VM417:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM418:1 Uncaught TypeError: Cannot set property 'safeBlur' of undefined(…)(anonymous function) @ VM418:1(anonymous function) @ VM418:1(anonymous function) @ VM418:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM423:1 Uncaught TypeError: d.widget is not a function(…)(anonymous function) @ VM423:1(anonymous function) @ VM423:1(anonymous function) @ VM423:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21dialog @ VM407:28bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:53i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM426:7 Uncaught TypeError: d.ui.safeActiveElement is not a function(…)

SLIDER
Example:

		<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
		<sj:head locale="es" jquerytheme="start"/>
		<sj:slider id="simpleslider"/>
Chrome console errors:
  VM45:1 Uncaught TypeError: b.widget is not a function(…)(anonymous function) @ VM45:1(anonymous function) @ VM45:1(anonymous function) @ VM45:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21slider @ VM44:40bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:160i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM47:1 Uncaught TypeError: Cannot set property 'keyCode' of undefined(…)(anonymous function) @ VM47:1a.ui.keyCode.BACKSPACE @ VM47:1(anonymous function) @ VM47:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21slider @ VM44:40bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:160i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM49:2 Uncaught TypeError: b is not a constructor(…)c.widget @ VM49:2(anonymous function) @ VM50:1(anonymous function) @ VM50:1(anonymous function) @ VM50:1globalEval @ jquery-2.2.4.min.js:2text script @ jquery-2.2.4.min.js:4Ab @ jquery-2.2.4.min.js:4z @ jquery-2.2.4.min.js:4(anonymous function) @ jquery-2.2.4.min.js:4send @ jquery-2.2.4.min.js:4ajax @ jquery-2.2.4.min.js:4(anonymous function) @ jquery.struts2.min.js?s2j=4.0.1:21each @ jquery-2.2.4.min.js:2require @ jquery.struts2.min.js?s2j=4.0.1:21slider @ VM44:40bind @ jquery.struts2.min.js?s2j=4.0.1:30(anonymous function) @ logout:160i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2ready @ jquery-2.2.4.min.js:2J @ jquery-2.2.4.min.js:2
  VM44:42 Uncaught TypeError: c.slider is not a function(…)

Latest snapshot working version: 4.0.1-20160922.161421-11, but I have just realized that version 4.0.1-SNAPSHOT was removed from snapshot's repository.

Thanks!

@sdutry sdutry self-assigned this Dec 14, 2016
@sdutry
Copy link
Contributor

sdutry commented Dec 14, 2016

created git repository that can simulate problem:
(created with the archetype and updated versions)

https://github.com/sdutry/issue89

start with mvn jetty:run

then go to http://localhost:8080/issue89/issue89.action

I'm not completely confident that it's not just a misconfiguration since the showcase site does work.
I'll investigate further.

@flofourcade
Copy link
Contributor

Got the same issue with autocompleter. Seems like core.js (jquery ui) is not loaded. Using loadAtOnce=true in the head tag should fix the problem. Maybe the showcase is configured this way.

@sdutry
Copy link
Contributor

sdutry commented Dec 14, 2016

@flofourcade loading too late of one of the libraries could be the problem

Uncaught TypeError: $.ui.safeActiveElement is not a function(…)

The fact that none of the specific items actualy get executed right away on the showcase might be the reason why it works.

doesn't look like the showcase is configured with the loadAtOnce="true" attribute

    <s:if test="%{theme == 'showcase' || theme == null}">
        <sj:head debug="false" compressed="true" jquerytheme="showcase" customBasepath="themes" 
                 loadFromGoogle="%{google}" ajaxhistory="%{ajaxhistory}" defaultIndicator="myDefaultIndicator"
                 defaultLoadingText="Please wait ..."/>
    </s:if>
    <s:else>
        <sj:head debug="false" compressed="true" jquerytheme="%{theme}" loadFromGoogle="%{google}" 
                 ajaxhistory="%{ajaxhistory}" defaultIndicator="myDefaultIndicator"
                 defaultLoadingText="Please wait ..."/>
    </s:else>

@flofourcade
Copy link
Contributor

Ok.Saw that head.ftl has been changed. I ll take a look tomorrow .

@sdutry
Copy link
Contributor

sdutry commented Dec 15, 2016

@flofourcade
for some reason loading jquery from google also fixes the problem:
loadFromGoogle="true"

@sdutry
Copy link
Contributor

sdutry commented Dec 15, 2016

loaded from google:

    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="/issue89/struts/js/plugins/jquery.form.js?s2j=4.0.2-SNAPSHOT"></script>
<script type="text/javascript" src="/issue89/struts/js/plugins/jquery.subscribe.js?s2j=4.0.2-SNAPSHOT"></script>

<script type="text/javascript" src="/issue89/struts/js/struts2/jquery.struts2.js?s2j=4.0.2-SNAPSHOT"></script>

<script type="text/javascript">
    $(function () {
        jQuery.struts2_jquery.version = "4.0.2-SNAPSHOT";
        jQuery.struts2_jquery.debug = true;
        jQuery.struts2_jquery.loadAtOnce = true;
        jQuery.scriptPath = "/issue89/struts/";
        jQuery.struts2_jquery.minSuffix = "";
        jQuery.ajaxSettings.traditional = true;

        jQuery.ajaxSetup({
            cache: false
        });

        jQuery.struts2_jquery.require("js/struts2/jquery.ui.struts2.js?s2j=4.0.2-SNAPSHOT");

    });
</script>

        <link id="jquery_theme_link" rel="stylesheet"
              href="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/start/jquery-ui.css" type="text/css"/>

not loaded from google

        <script type="text/javascript" src="/issue89/struts/js/base/jquery-2.2.4.js"></script>
        <!-- script type="text/javascript" src="/issue89/struts/js/base/core.js?s2j=4.0.2-SNAPSHOT"></script -->
<script type="text/javascript" src="/issue89/struts/js/plugins/jquery.subscribe.js?s2j=4.0.2-SNAPSHOT"></script>

<script type="text/javascript" src="/issue89/struts/js/struts2/jquery.struts2.js?s2j=4.0.2-SNAPSHOT"></script>

<script type="text/javascript">
    $(function () {
        jQuery.struts2_jquery.version = "4.0.2-SNAPSHOT";
        jQuery.struts2_jquery.debug = true;
        jQuery.scriptPath = "/issue89/struts/";
        jQuery.struts2_jquery.minSuffix = "";
        jQuery.ajaxSettings.traditional = true;

        jQuery.ajaxSetup({
            cache: false
        });

        jQuery.struts2_jquery.require("js/struts2/jquery.ui.struts2.js?s2j=4.0.2-SNAPSHOT");

    });
</script>

        <link id="jquery_theme_link" rel="stylesheet"
              href="/issue89/struts/themes/start/jquery-ui.css?s2j=4.0.2-SNAPSHOT"
              type="text/css"/>

so unless i'm mistaken, it's missing the following javascripts:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="/issue89/struts/js/plugins/jquery.form.js?s2j=4.0.2-SNAPSHOT"></script>

@matorodriguez
Copy link
Contributor Author

matorodriguez commented Dec 15, 2016

Great.
Note: when loading from Google, a HTTP NOT FOUND arises:
http://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/i18n/datepicker-es.min.js
Seems fine when using loadAtOnce.

@sdutry
Copy link
Contributor

sdutry commented Dec 15, 2016

further testing shows that without the loadFromGoogle or the loadAtOnce the jquery-ui.js file never gets loaded.

from google:

<#if parameters.loadFromGoogle?default(false)>
    <#if parameters.jquery?default(true)>
    <script type="text/javascript" src="${jqueryGoogle}"></script>
    </#if>
    <#if parameters.jqueryui?default(true)>
    <script type="text/javascript" src="${jqueryUiGoogle}"></script>
...

not from google:

<#else>
    <#if parameters.jquery?default(true)>
        <script type="text/javascript" src="${javaScriptBasePath}js/base/${jqueryFile}"></script>
    </#if>
    <#if parameters.jqueryui?default(true)>
        <#if parameters.loadAtOnce?default(false)>
        <script type="text/javascript" src="${javaScriptBasePath}js/base/${jqueryUIFile}"></script>
...

I think it might be nescessary to always load the jquery-ui.js immediately, even with the loadAtOnce to be false.
I can't realy find it being loaded through a self.require call anywhere else

@sdutry
Copy link
Contributor

sdutry commented Dec 15, 2016

@matorodriguez it seems like the google urls don't contain the i18n folder with the different translations for version 1.12.1, which this setup assumes.

It did for all previous versions, so the only current workaround option you have is to add loadAtOnce="true" (it does have the translation files packaged inside with the struts2-jquery-plugin)

@matorodriguez
Copy link
Contributor Author

Great work @sdutry, thanks a lot!

@sdutry
Copy link
Contributor

sdutry commented Dec 15, 2016

@jogep @flofourcade
i made the following branch with what i think would fix this issue:
issue89

The problem i have is that the moment i made the branch off of release/4.0.2 , my branch was already 2 commits ahead (and they're not mine).
So i'm not sure how to start a pull-request with only the changes i made.

@flofourcade
Copy link
Contributor

flofourcade commented Dec 16, 2016

The problem with always loading jquery-ui.js is that we loose the "lazy" loading of jquery-uis's component when loadAtOnce and loadFromGoogle are false. When false, the expected behaviour is that each widget use self.require to load each needed jquery-ui's component using the splitted version of jquery ui js (selectable.js, core.js, slider.js,...).

Between the last snapshot and the release, this splitted version of jquery ui has changed (new unique-id.js, some functions have been moved to other file,...) .

I think the only way to restore the expected behaviour of loadAtOnce="false" is to test every widget individually and to fix broken dependencies with self.require.
By eg, the autocompleter tag uses $(..).uniqueId, previously declared in core.js, but now in it's own file unique-id.js, but autocompleter in jquery.ui.struts2.js has not been updated to load this new dependency ...

@sdutry
Copy link
Contributor

sdutry commented Dec 16, 2016

@flofourcade
Ok,

I can try to have a look at it this weekend, working my way through them one at a time.

ps: any idea how to get around the 2 commits ahead the moment i make a fork?

@flofourcade
Copy link
Contributor

Sorry, I'm far to be a github's specialist ! Maybe is there a way to exclude some file when you'll create your PR ?

@lukaszlenart
Copy link
Member

ps: any idea how to get around the 2 commits ahead the moment i make a fork?

Use origin ;-)

The best option to prepare PRs is to clone the original repo locally, then make a fork on GitHub, add it as a remote to your cloned original repo

git remote add fork git@....

now when you're at master create a branch

git checkout -b my-patch

make changes and commit, now push to your fork

git push -u fork my-patch

go to GitHub and you will see that you can create a PR, open it and you're done :)

When your PR went in, update master from origin and drop the branch

git checkout master
git fetch -p
git pull
git branch -d my-patch

and you can start creating a new PR :)

@sdutry
Copy link
Contributor

sdutry commented Dec 17, 2016

@lukaszlenart
i did the following:

  1. added a remote to the original repo ( git remote add upstream <git repo> )
  2. created a branch out of the remote branch from the original repo ( checkout -b <branchname> )
  3. push that to my fork of the repo ( git push origin <branchname>)
  4. branch is 2 commits ahead of ...

So i don't know where those commits originate from

edit:
nvm, it might be a github interface issue, since when i go to the branches overview, it says it's even. It's only when going to the specific branch that it shows the bar "2 commits ahead"

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade
I'd like you to check that what i'm doing is correct.
Currently fixed the sj:dialog by adding jquery-ui to the scripts to require. (since the problem there was that jquery.ui was undefined)

see commit

I'll continue going through the rest 1 by 1, i just wanted to know if i was heading the right way with this fix.

@flofourcade
Copy link
Contributor

@sdutry
You may try first first with core.js which contains main jquery ui functions/declarations for the splitted version of jquery ui for lazy loading.
If you look at the current version of head.ftl, you'll see that the loading of core.js has been commented, but not added to the require directive of some widget that need it.
If you want i will make some test and tell you here.

@flofourcade
Copy link
Contributor

@sdutry
Making widget.js first in the require directive make the dialog working. No need to add core.js or jquery-ui.js !

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade
Ok, thx for the info.

I was still juggling with the javascripts to figure it out.

@flofourcade
Copy link
Contributor

Ok, I've tested dialogs-*.jsp of the showcase in isolation (loading it without ajax and with a sj:head without loadAtOnce or loadByGoogle).
If widget.js is loaded first everything works.
dialog-modal.jsp is broken, seems there is a problem with opacity attributes, leading to incorrect JS generated by the tag. Removing them fix the problem.

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade

finaly found why it had to be first:

inside mouse.js (which was previously first) there is the following code:

return $.widget( "ui.mouse", {

@flofourcade
Copy link
Contributor

The sad thing is that we have to test all tags in isolation, it's highly probable that other tags are impacted !

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

i'll start by going around and fixing the location of widget.js wherever mouse.js is loaded.

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade

seems that one of the main problems for some of the javascripts like

  • keycode.js
  • safe-active-element.js

would be that they don't have jQuery.ui defined.

putting a javascript infront of them that has the following ui dummy definition if it doesn't exist, fixes it:
$.ui = $.ui || {};

maybe it would be a better idea to put the version.js inside the head.ftl ?
(since all that does is setting the version of jQuery.ui)

or would it be an option to modify the files with the problems to add the code below to them?
$.ui = $.ui || {};

@flofourcade
Copy link
Contributor

flofourcade commented Dec 18, 2016

@sdutry
To fix autocompleter :
jquery.ui.struts:.js line 866

self.require([                	
   "js/base/widget" + self.minSuffix + ".js",                                      
    "js/base/version" + self.minSuffix + ".js",                   
    "js/base/unique-id" + self.minSuffix + ".js",
     "js/base/position" + self.minSuffix + ".js",
     "js/base/menu" + self.minSuffix + ".js",
    "js/base/keycode" + self.minSuffix + ".js",
    "js/base/safe-active-element" + self.minSuffix + ".js",
    "js/base/autocomplete" + self.minSuffix + ".js"
  ]);

and jquery.ui.struts:.js line 1050

 self.require([ "js/base/widget" + self.minSuffix + ".js", "js/base/button" + self.minSuffix + ".js","js/base/tooltip" + self.minSuffix + ".js" ]);

Needed to add unique-id.js and tooltip.js for combobox and to change depencies loading order.

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade i just did that and commited it, although my ordering of requires is a bit different

edit: i noticed your self.require adjustment for autocomplete-selectboxes and updated code accordingly.

@flofourcade
Copy link
Contributor

Yes you're right for keycode and safe-active-element, got the same problem while trying to fix autocomplete. We can try your solution based on version.js I think it's a good way.

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade

which solution then?

  1. adding $.ui = $.ui || {}; in head.ftl
  2. adding version.js in head.ftl
  3. changing the javascripts that don't include the $.ui = $.ui || {}; empty object creation if it doesn't exist

@flofourcade
Copy link
Contributor

Add version.js to head.ftl. you can declare it in place of the commented declaration of core.js which is deprecated now. With this setup, version.js will be loaded when in lazy mode

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

@flofourcade
version.js added with this commit

@sdutry
Copy link
Contributor

sdutry commented Dec 18, 2016

additional problem:

jquery.combobox.js and jquery.combobox.min.js are out of sync, resulting in different classes being added to the autocompleter-selectbox.

(will fix shortly, just putting it here so i don't forget)

Edit: fixed with this commit

@lukaszlenart
Copy link
Member

@sdutry no idea what's wrong, I'm always fetch & pull the original repo before creating a branch and it works like a charm.

@sdutry
Copy link
Contributor

sdutry commented Dec 19, 2016

@flofourcade

can you check something for me:

when trying to load the datatables-group.action seperately, the collapsing of the groups isn't working.

the problem seems to be that the following javascript is executed before the table is loaded and thus doesn't get the chance to bind the click on the rows.

$('#groupTable tbody').on( 'click', 'tr.group', function () {
	var group = $(this).data("group");
	$(this).toggleClass("collapsed");
	$("tr.child-of-group-"+group).toggle();
});

placing those lines inside a document ready is what fixes it for me, but i'm not sure if it's something that should be addressed or if it's only a local problem for me. (or if this is the preferred workaround/solution)

@flofourcade
Copy link
Contributor

Ok will have a look a this ASAP.

@sdutry
Copy link
Contributor

sdutry commented Dec 20, 2016

checked tags (against branch issue89fix )(will be updated):
ok:

  • sj:a
  • sj:accordion
  • sj:autocompleter
  • sjc:chart
  • sjc:chartData
  • sj:datepicker
  • sj:dialog
  • sjg:grid
  • sjdt:datatables
  • sj:menu
  • sj:progressbar
  • sjr:ckeditor
  • sjr:tinymce
  • sj:slider
  • sj:spinner
  • sjt:tree
  • sj:checkboxlist
  • sj:textfield
  • sj:radio
  • sj:select

broken:

  • sj:tabbedpanel
    • tabs-preselect.action when minified
      • Cannot create property 'complete' on boolean 'true'
  • sj:div
    • remote-div-reload.action
      • when clicking the submit button
        • Cannot read property 'replace' of undefined
  • sj:textarea
    • form-textarea-resizeable.action
      • when typing in the textarea
        • e.preventDefault is not a function
  • effect-div-extend.action
    • this._handles.disableSelection is not a function

(moved comment to the bottom to keep track of what's checked)

@sdutry
Copy link
Contributor

sdutry commented Dec 20, 2016

@flofourcade @jogep

Considering the branch i'm working on for this issue has a lot of changes already, i was thinking about making a pull request for what's fixed and moving the other remaining (mostly minor) problems into their own issues.

I'd like to hear your opinion on this.
Also if:

  • I overlooked an issue
  • created a new problem
  • you want me to check other tags/combinations

please let me know, so i could fix them before making the pull-request.

link to branch: issue89fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants