There have been some recent changes in AjaxDirectLink,
so I'll simply describe another way of doing this.

The onclick attribute now contains "url:this.href"
This means that if you can get a reference to your link element and
change its href (for instance, to add dynamic parameters) ,
then onclick and the resulting ajax request will use that new href.

So, a way to do something like this is:

            var myObj = new Object();
            myObj.tellMe = function(e){
                // e.target is the old href
                // you'll have to tweek this a bit - as is now it keeps
appending
                // params to the href         
                dojo.byId('testDL').href = e.target + "&testId=1" ;
            }
           
            dojo.event.connect("before", dojo.byId('testDL'),
                'onclick', myObj, 'tellMe');

I'm also aware of another way of doing this without using dojo, just
custom tacos preEffects !
I was planning on explaining how one can write custom effects when it
hit me that those custom
effects can do many other stuff instead of simple fades, highlights, e.t.c.

Finally, there's also Bug47. When this gets added, you'll have even more
options.


Mircea Militaru wrote:

> 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
>


-------------------------------------------------------
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

Reply via email to