Hi guys!
We had some problems trying to use this component because it does not
allow to add dynamic parameters in the ajax request url. What we mean by
dynamic parameters is to be able to add an input value or any other
value that may be changed after the page is rendered. We allow a
javascript function to do modifications on the generated url before the
request to ajax is done. This javascript function wil return the
modified url which will be used to do the request.
We would like this feature to be added tacos AjaxDirectLink or any other
components where this may be useful. Here are our modification to the
AjaxDirectLink.java file:
AjaxDirectLink.java:
public String getListenerURL( IRequestCycle cycle )
{
ILink link = this.getLink( cycle );
return "tacosURL = '" + link.getAbsoluteURL() + "';";
}
/**
*
* [EMAIL PROTECTED]
*/
public void renderAdditionalAttributes(IMarkupWriter writer,
IRequestCycle cycle) {
if (!cycle.isRewinding()) {
PageRenderSupport pageRenderSupport =
TapestryUtils.getPageRenderSupport(cycle, this);
getScript().execute(cycle, pageRenderSupport, null);
super.renderAdditionalAttributes(writer, cycle);
writer.attribute("onclick", "javascript:"
+ getPreEffectsScript()
// set url
+ getListenerURL(cycle)
// run custom function
+ "if (self.tacosCustomAction)
tacosURL=tacosCustomAction(this,tacosURL);"
+ getLinkString(cycle)
+ "; return false;");
writer.attribute("id", getIdParameter());
}
}
/**
* Returns a javascript string representation of the kwArgs object
* passed into tacos.defaultLinkAction.
* @param cycle
* @return
*/
public String getLinkArguments(IRequestCycle cycle)
{
ILink link = this.getLink(cycle);
//Build js structure
StringBuffer str = new StringBuffer("{");
str.append("targetLink: this, ");
if (getUpdateObject() != null)
str.append("updateObject: ").append(getUpdateObject()).append(",");
str.append("url: tacosURL, ");
str.append("processScripts: ").append(true);
if (getEffects() != null) {
str.append(", effects:
").append(StringUtils.escapeJavaScriptHash(getEffects()));
}
if (getPopup() != null) {
str.append(", popup:
").append(StringUtils.escapeJavaScriptHash(getPopup()));
}
if (getStatusElement() != null)
str.append(", statusElement:
'").append(getStatusElement()).append("'");
return str.append("}").toString();
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel