struts-community-plugins / struts2-jquery

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

@id with dynamic variable doesn't work anymore #308

Closed Dcosmas closed 1 year ago

Dcosmas commented 1 year ago

Since release 5.0.0 we can't have multiple dialog

<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>

<s:iterator value="myBeanList" var="rrSum" status="status">

  <sj:dialog id="dialog%{#status.index}" href="%{ajaxURL}" title="Testing %{#status.index}" />
  <sj:a openDialog="dialog%{#status.index}"><s:property value="#rrSum.rid" /></sj:a>

 </s:iterator>

title param will be correct --> Testing 1, Testing 3 etc... but id will be dialog%{#status.index} whereas dialog1, dialog2 etc...

what did i miss? Is it a real bug ? or new feature ? :)

lukaszlenart commented 1 year ago

id has to be unique in the whole document, see docs so this is ok

Dcosmas commented 1 year ago

no problem for it to be unique. I just want to generate it myself. Or could you explain to me how to have several dialogs in the same page ? Again with last version of the plugin (4.0.3) this code worked fine and generate one dialog@id by concate the string "dialog" and the variable "%{#status.index}".

lukaszlenart commented 1 year ago

Hmmm ... I do not understand, you can change <sj:dialog id="my_dialog_%{#status.index}_id" to have your own id, or did you mean that now you get dialog%{#status.index} instead of dialog1, dialog2,...?

Dcosmas commented 1 year ago

Absolutely, I mean that now I get dialog%{#status.index} instead of dialog1, dialog2

lukaszlenart commented 1 year ago

So this is a bug

lukaszlenart commented 1 year ago

Could you try to use id="%{'dialog' + #status.index}"?

Dcosmas commented 1 year ago

not better :/ And I have the same problem with sj:datepicker

but thanks for the try :)

sdutry commented 1 year ago

I think i spotted the problem, i'll create a PR for it.

lukaszlenart commented 1 year ago

@sdutry you can use parameters.escapedId instead of parameters.id