struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

Problem migrating to Struts2 jQuery Plugin 5.0.3. #346

Closed hss-ch closed 10 months ago

hss-ch commented 1 year ago

Hi, I am facing these problems when I try to migrate to Struts2 jQuery Plugin 5.0.3.

  1. We want to use the tag sj:select with attribute autocomplete="true" for auto completion. But the tag sj:select with attribute autocomplete="true" is not working , without using sj:autocompleter tag in the same jsp page.

  2. We are unable to perform show/hide operations on a grid.

lukaszlenart commented 1 year ago

Is this issue something else than #345?

lukaszlenart commented 1 year ago

Do you get any JavaScript error in console?

hss-ch commented 1 year ago

Yes. When we use sj:select without sj:autocompleter in the same jsp page and if any option is selected in the list, we are always getting first option and we are also getting the following error in console:

jQuery.Deferred exception: b(...).appendTo(...).val(...).attr(...).addClass(...).autocomplete(...).tooltip is not a function TypeError: b(...).appendTo(...).val(...).attr(...).addClass(...).autocomplete(...).tooltip is not a function at c..._createAutocomplete (:2:189) at c..._createAutocomplete (:3:98) at c..._create (:1:196) at c..._create (:3:98) at c..._createWidget (:7:196) at new c.. (:2:202) at HTMLSelectElement. (:5:428) at Function.each (http://localhost:8090/p8/static/js/base/jquery-3.7.0.min.js:2:3129) at ce.fn.init.each (http://localhost:8090/p8/static/js/base/jquery-3.7.0.min.js:2:1594) at c.fn. [as combobox] (:5:338) undefined

[struts2_jquery] bind button on submit_1267952425 jquery.struts2.min.js?s2j=5.0.3:19 [struts2_jquery_ui] init button with id: submit_1267952425 jquery.struts2.min.js?s2j=5.0.3:19 [struts2_jquery] formsubmit : submit_1267952425 jquery.struts2.min.js?s2j=5.0.3:19 [struts2_jquery_ui] bind tabbedpanel on showautocompletecode jquery.struts2.min.js?s2j=5.0.3:19 [struts2_jquery_ui] tabbedpanel : showautocompletecode jquery.struts2.min.js?s2j=5.0.3:19 [struts2_jquery_ui] load require script /p8/static/js/base/tabs.min.js?s2j=5.0.3

Uncaught TypeError: b(...).appendTo(...).val(...).attr(...).addClass(...).autocomplete(...).tooltip is not a function at c..._createAutocomplete (:2:189) at c..._createAutocomplete (:3:98) at c..._create (:1:196) at c..._create (:3:98) at c..._createWidget (:7:196) at new c.. (:2:202) at HTMLSelectElement. (:5:428) at Function.each (jquery-3.7.0.min.js:2:3129) at ce.fn.init.each (jquery-3.7.0.min.js:2:1594) at c.fn. [as combobox] (:5:338)

The following attributes are also not working in this case for sj:select: onChangeTopics="autocompleteChange" onFocusTopics="autocompleteFocus" onSelectTopics="autocompleteSelect"

hss-ch commented 12 months ago

In Struts2 jQuery Plugin 4.0.1, it is working fine

lukaszlenart commented 12 months ago

In Struts2 jQuery Plugin 4.0.1, it is working fine

Because this version used an old version of JQuery, 5.x version of the plugin a lot has changed in JQuery and it's sometimes very hard to figure out how to adjust the plugin code.

lukaszlenart commented 12 months ago

Could you test the linked PR?