tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erich Gormann (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2329) Autocomplete needs a context to work in a Loop
Date Tue, 13 May 2014 07:56:15 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13996173#comment-13996173
] 

Erich Gormann commented on TAP5-2329:
-------------------------------------

Meanwhile I found a way to pass context information to the event handler method by using the
JSON config parameter "url" of the Autocomplete mixin.
I first added an additional parameter to the component:

@Parameter(allowNull = true, required = false)
private String contextInfo;

Then I added the following method:

public String getExtendedClientId(String clientId) {

		StringBuffer extendedClientId = new StringBuffer(clientId);

		if (contextInfo != null) {

			extendedClientId.append("~");
			extendedClientId.append(contextInfo);
		}

		return extendedClientId.toString();
	}

Finally I added these two lines in void afterRender(MarkupWriter) below the link creation:

String extendedId = getExtendedClientId(field.getClientId());
link.addParameter("extendedfieldid", extendedId);

In my event handler method I now can retrieve the context information as URL parameter using
the Request service. 
After spiltting it at the delimiter token the client id of the requesting autocomplete field
and the context information is available. 



> Autocomplete needs a context to work in a Loop
> ----------------------------------------------
>
>                 Key: TAP5-2329
>                 URL: https://issues.apache.org/jira/browse/TAP5-2329
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.3, 5.4
>            Reporter: Geoff Callender
>
> This is a request to bring Autocomplete into line with Form, EventLink, and ActionLink,
all of which already have a context.
> An example of how this will help is when an Autocomplete is in a Loop where the server-side
cannot provide the right list of completions unless it knows something about the row. For
example, autocompleting Town in a row that represents a particular State, listing only the
Towns of that State.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message