[TYPO3-ect] AJAX and thickbox

Philip Almeida philip.almeida at gmail.com
Thu Sep 20 20:02:43 CEST 2007


After all is "my own limitation" I come upon it on link:
http://community.xajaxproject.org/viewtopic.php?id=5528 with title (xajax
and thickbox not working)

I just forgot that I must do the calls to javascript functions using xajax
addScript method:

=== Example code ===
       $out = "<a id="newlink" href="theFullThickboxlink class="thickbox">";
       $response = tx_div::makeInstance('tx_xajax_response');
       $response->addAssign($swapContainer, 'innerHTML', $out);
       $response->addScript("$(document).ready(function() {
    $('a.load-local').cluetip({
    activation: 'click',
    local:true,
    sticky: true,
    closePosition: 'title',
    closeText: 'Fechar',
    cursor: 'pointer'});
});"); // --> The line that was missing
        return $response->getXML();

Solved.

On 9/19/07, Philip Almeida <philip.almeida at gmail.com> wrote:
>
> Sorry if I did not explain the problem correctly but I think your solution
> would not  result although I did not test.
> My problem was (and is although the workaround).
>
> The first time the page is rendered it contains the link that activates
> the
> thickbox:
> === example code ===
> <a id="originallink"
> href="'http://www.mypage.com?&TB_iframe=true&height=400&width=750<
> http://www.mypage.com/?&TB_iframe=true&height=400&width=750>'"
> class="thickbox">
> Launch
> </a>
> <div id="newthickboxlink"></div>
>
> At this moment It works fine no problem.
> Then when I make a ajax request using xajax with MVC framework I put
> another
> link inside "newthickboxlink" div. So now I have:
>
> === example code ===
> <a id="originallink"
> href="'http://www.mypage.com?&TB_iframe=true&height=400&width=750<
> http://www.mypage.com/?&TB_iframe=true&height=400&width=750>'"
> class="thickbox">
> Launch
> </a>
> <div id="newthickboxlink">
> <!-- code generated by request start-->
> <a id="newlink"
> href="'http://www.mysecondpage.com?&TB_iframe=true&height=400&width=750<
> http://www.mypage.com/?&TB_iframe=true&height=400&width=750>'"
> class="thickbox">
> Launch
> </a>
> <!-- code generated by request end-->
> </div>
>
> This new link does not activate thickbox(i don't know why but it doesn't
> work). I suspect is because the new link is not written in the original
> rendered page and is just a result of a ajax request.
>
> Well now the workaround was this.
> === example code ===
> <a id="originallink"
> href="'http://www.mypage.com?&TB_iframe=true&height=400&width=750<
> http://www.mypage.com/?&TB_iframe=true&height=400&width=750>'"
> class="thickbox">
> Launch
> </a>
> <div id="newthickboxlink">
> <!-- code generated by request start-->
> <input id="newlink" type="button" onclick="document.getElementById
> ("originallink").href="'
> http://www.mysecondpage.com?&TB_iframe=true&height=400&width=750<
> http://www.mypage.com/?&TB_iframe=true&height=400&width=750
> >'";document.getElementById("originallink").click();"
> value="openme"/>
>
> <!-- code generated by request end-->
> </div>
>
> I had the code in
> http://www.faqts.com/knowledge_base/view.phtml/aid/9368/fid/128 so it
> works
> in firefox.
>
> Thanks for the reply Steffen,
> what you are saying is to had a onclick-handler to "originallink" so it
> detects a click on the "newlink" and reacts, clicking itself ?  :O
> Yes I complicate the thing but try yourself if you have time.
> I am affraid this is a limitation of xajax and jquery or my own limitation
> if the first is correct this is bad news.
> I am not using jquery extension I am including the thickbox via the
> thickbox
> extension.
>
> ----------------------------------------------------------------------------------------------------------------------------
> PS: today I meet www.pageflakes.com & www.netvibes.com for those that
> don't
> now this  google.com/ig alike please visit they are ajax in all it's
> beauty
> 100%.
>
> On 9/19/07, Steffen Kamper <steffen at sk-typo3.de> wrote:
> >
> > Hi Philip,
> >
> > "Philip Almeida" <philip.almeida at gmail.com> schrieb im Newsbeitrag
> > news:
> >
> mailman.158.1190205016.15140.typo3-team-extension-coordination at lists.netfielders.de
> > ...
> > > Well I make a work around.
> > >
> > > Put the link in the first calling page(not in a ajax request).
> > > Then in all ajax request I alter the href attribute via javascript
> with
> > > element id and call the link via javascript DOM link() when needed.
> > >
> > > The click() DOM attribute does not work in Firefox because W3C says it
> > > should not apply to A tags, I found this work around for firefox (
> > > http://www.faqts.com/knowledge_base/view.phtml/aid/9368/fid/128)
> > >
> > > Well now I have thickbox and xajax working.
> > >
> > > regards,
> > >
> > > philip
> > >
> >
> > this sounds to complicate for me.
> > If you still use jquery you can make a calll from js, make a dom-query
> to
> > the link and add a onclick-handler,
> > then you need nothing more, also no collision with W3C-issues.
> >
> > vg  Steffen
> >
> > > On 9/19/07, Philip Almeida <philip.almeida at gmail.com> wrote:
> > >>
> > >> Hello ECT,
> > >>
> > >> yesterday I come into a "thing" I want to share to see if you now
> > >> something
> > >> more:
> > >> I am using MVC with xajax.
> > >> I wanted to use "thickbox" (http://jquery.com/demo/thickbox/) from
> > jquery
> > >> to
> > >> lunch a iframe.
> > >>
> > >> If I insert the launch code beneath in the original html page it
> works:
> > >> <a href="'http://www.mypage.com?&TB_iframe=true&height=400&width=750
> '"
> > >> class="thickbox">
> > >> Launch
> > >> </a>
> > >>
> > >> If the same code is call by ajax (this is, a ajax call  returns the
> > above
> > >> code to the browser) it falls.
> > >>
> > >> Any ideias?
> > >>
> > >> thanks,
> > >>
> > >> philip
> > >> _______________________________________________
> > >> TYPO3-team-extension-coordination mailing list
> > >> TYPO3-team-extension-coordination at lists.netfielders.de
> > >>
> > >>
> >
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination
> > >>
> > >
> > >
> > >
> > > --
> > > -- -- -- -- -- -- -- -- -- -- -- -- --
> > > Philip de Oliveira de Almeida
> > > Tel. 966 356 008
> >
> >
> > _______________________________________________
> > TYPO3-team-extension-coordination mailing list
> > TYPO3-team-extension-coordination at lists.netfielders.de
> >
> >
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination
> >
>
>
>
> --
> -- -- -- -- -- -- -- -- -- -- -- -- --
> Philip de Oliveira de Almeida
> Tel. 966 356 008
> _______________________________________________
> TYPO3-team-extension-coordination mailing list
> TYPO3-team-extension-coordination at lists.netfielders.de
>
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination
>



-- 
-- -- -- -- -- -- -- -- -- -- -- -- --
Philip de Oliveira de Almeida
Tel. 966 356 008


More information about the TYPO3-team-extension-coordination mailing list