Hi Andrew,
Thank you for your help. It's working now.
Pdt
Andrew Robinson-5 wrote:
>
> Make sure that the popup javascript file is being loaded, I think it
> has an external one. You may have to force it to load the first time
> the page loads. AA isn't very robust with handling external JS and CSS
> references.
>
> On 8/17/07, pdt_p <[EMAIL PROTECTED]> wrote:
>>
>> Hi ....,
>>
>> I did mention about this in my previous messge : "At the moment I haven't
>> found a way how to pass a htmlpopup client id to my page. I am thinking
>> of
>> storing the htmlpopup client id in a static HashMap in a class.".
>> What I did is I bind the t:popup and get the clientID from the bind
>> object.
>> I use the client id by calling "JavascriptUtils.getValidJavascriptName"
>> in
>> order to generate a variable name which tomahawk will generate.
>> This is used for tell AA that this "var" is a global variable.
>> the code for AA like (I put this in my jsp page):
>> <%
>> ... get my backing bean assume the variable name called popupBean....
>>
>> String popupClientId = popupBean.getPopupGlobalVarName();
>> %>
>> AjaxAnywhere.prototype.getGlobalScriptsDeclarationsList =
>> function(script) {
>> var gloVar = new Array();
>> gloVar.push('<%=popupClientId %>');
>> return gloVar;
>> }
>>
>>
>> but unfortunatelly, the Tomahawk popup box is still not displaying. any
>> idea?
>>
>> Thank you very much,
>>
>> Pdt
>>
>>
>>
>> pdt_p wrote:
>> >
>> > Hi Andrew,
>> >
>> > I have checked the aa.js api. i think you refer to this function
>> > getGlobalScriptsDeclarationsList. I did overwrite this function in my
>> jsp
>> > page and return an array of global variable.
>> > but the tomahawk popup window still not popup as what I expected. any
>> idea
>> > about this?
>> > The way how do I get the htmlpopup client id is by viewing the jsp
>> source
>> > code and get the html popup id from there. When I reload the page I can
>> > see the htmlpopup global variable still remain the same.
>> > the code in getGlobalScriptsDeclarationsList is straight forward
>> (delcare
>> > an array, add an string object and return the array), something like
>> this:
>> >
>> > AjaxAnywhere.prototype.getGlobalScriptsDeclarationsList =
>> function(script)
>> > {
>> > var gloVar = new Array();
>> > gloVar.push('Tree2Id_3A0_3A_5Fid9Popup');
>> > return gloVar;
>> > }
>> >
>> > At the moment I haven't found a way how to pass a htmlpopup client id
>> to
>> > my page. I am thinking of storing the htmlpopup client id in a static
>> > HashMap in a class. but i don't think this is a good way. any
>> suggestion
>> > for this?
>> >
>> > Thanks,
>> >
>> > Pdt
>> >
>> >
>> > pdt_p wrote:
>> >>
>> >> Hi Andrew,
>> >>
>> >> Thank you for your help. I will give it a try.
>> >>
>> >> Thanks,
>> >>
>> >> Pdt
>> >>
>> >>
>> >> Andrew Robinson-5 wrote:
>> >>>
>> >>> Sorry, just remembered after saying that, I think I did have to setup
>> >>> some kind of registration with javascript (check the aa.js API) that
>> >>> told AA that the variable was a global variable and AA will
>> >>> automatically set a window variable from the var.
>> >>>
>> >>> FYI, the code that sets the variable gets the ID from:
>> >>>
>> >>> String popupId =
>> >>> JavascriptUtils.getValidJavascriptName(clientId+"Popup",false);
>> >>>
>> >>> On 8/16/07, Andrew Robinson <[EMAIL PROTECTED]> wrote:
>> >>>> It should work fine without any additional code. BTW - I stopped
>> using
>> >>>> AA a long time ago, and now switched to Trinidad from A4J
>> >>>>
>> >>>> On 8/16/07, pdt_p <[EMAIL PROTECTED]> wrote:
>> >>>> >
>> >>>> > Hi Andrew,
>> >>>> >
>> >>>> > Just wondering, have you able to integrate ajaxanywhere with
>> tomahawk
>> >>>> popup?
>> >>>> >
>> >>>> > Thanks,
>> >>>> >
>> >>>> > Pdt
>> >>>> >
>> >>>> >
>> >>>> > Andrew Robinson-5 wrote:
>> >>>> > >
>> >>>> > > Wondering if anyone has a work around for this...
>> >>>> > >
>> >>>> > > The tomahawk popup (1.1.2) is not AJAX friendly, at least not
>> >>>> AjaxAnywhere
>> >>>> > > friendly.
>> >>>> > >
>> >>>> > > The popup creates the following javascript in the renderer:
>> >>>> > > String popupId = JavascriptUtils.getValidJavascriptName
>> >>>> > > (clientId+"Popup",false);
>> >>>> > >
>> >>>> > > ResponseWriter writer = context.getResponseWriter();
>> >>>> > > writer.startElement(HTML.SCRIPT_ELEM, uiComponent);
>> >>>> > > writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR,
>> >>>> > > HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT,null);
>> >>>> > > writer.writeText("var "+popupId+"=new
>> >>>> > > orgApacheMyfacesPopup('"+clientId+"',"+
>> >>>> > >
>> >>>> (displayAtDistanceX==null?-5:displayAtDistanceX.intValue
>> >>>> > > ())+","+
>> >>>> > >
>> >>>> (displayAtDistanceY==null?-5:displayAtDistanceY.intValue
>> >>>> > > ())+");",null);
>> >>>> > > writer.endElement(HTML.SCRIPT_ELEM);
>> >>>> > >
>> >>>> > > As you can see, it uses the "var" syntax. To get JavaScript to
>> >>>> load,
>> >>>> > > AjaxAnywhere will execute an eval on the JavaScript contents. As
>> a
>> >>>> result,
>> >>>> > > this variable will immediately lose scope and not be available
>> to
>> >>>> code on
>> >>>> > > the page.
>> >>>> > >
>> >>>> > > If it was "window[" + popupId + "]" = new ..." it would bind the
>> >>>> > > javascript
>> >>>> > > variable to the window (the recommended method of having a
>> global
>> >>>> > > variable).
>> >>>> > >
>> >>>> > >
>> >>>> > > Has anyone come across this, and if so, found a workaround?
>> >>>> > >
>> >>>> > > -Andrew
>> >>>> > >
>> >>>> > >
>> >>>> >
>> >>>> > --
>> >>>> > View this message in context:
>> >>>>
>> http://www.nabble.com/Tomahawk-popup---AjaxAnywhere-tf1637487.html#a12192138
>> >>>> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>>> >
>> >>>> >
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Tomahawk-popup---AjaxAnywhere-tf1637487.html#a12196812
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Tomahawk-popup---AjaxAnywhere-tf1637487.html#a12245368
Sent from the MyFaces - Users mailing list archive at Nabble.com.