users@woodstock.java.net

Re: Table + AJAX

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Tue, 27 Nov 2007 12:06:04 -0500

Considering your code is based on a local "firstTime" variable, is your
bean session scoped? If the bean is request scoped, "firstTime" will be
initialized similarly during each request.

FYI, instead of refreshing each hidden field separately, you could use
the following code, instead. Note that when the component id is not
provided, the refresh function acts as a reset. That is, the component
will be redrawn only using values set server-side.

    newurlNode.refresh("toplevelform:j_id26:var1,
        toplevelform:j_id26:var2,
        toplevelform:j_id26:var3");

Dan

stuartr wrote:
> Sure
>
> What happens is that I generate a table using a binding and within the table
> there is a column
> which is a hyper link.
> I have defined an onclick to invoke a javascript function.
>
> I also have 3 hidden variables as
> <webuijsf:hidden id="var1" value="#{backingBean.var1Value}" />
> <webuijsf:hidden id="var2" value="#{backingBean.var2Value}" />
> <webuijsf:hidden id="var3" value="#{backingBean.var3Value}" />
>
> function linkClicked(row,data) {
>
> alert("User has pressed something on row "+row+" Data item "+data);
>
> newurlNode=document.getElementById("toplevelform:j_id26:var3");
> alert("Present value is "+newurlNode.text);
>
> // okay we have a drilldown on data within a panel of reports.
> rowDomNode=document.getElementById("toplevelform:j_id26:va1");
> rowDomNode.value=row;
> columnDomNode=document.getElementById("toplevelform:j_id26:var2");
> columnDomNode.value=data;
>
>
> rowDomNode.refresh("toplevelform:j_id26:var1,toplevelform:j_id26:var2");
>
> // now refresh the actual new urlnode to having a new value.
>
> columnDomNode.refresh("toplevelform:j_id26:var3");
>
> newurlNode=document.getElementById("toplevelform:j_id26:var3");
>
> newurlNode.refresh(); // get the value from the back end.
>
>
> alert("THe value should have changed by now "+newurlNode.value);
>
> popupWin = window.open(newurlNode.value,'View File
> Link','scrollbars,resizable,width=700,height=900,top='+((screen.height -
> (screen.height/1.618)) - (500/2))+',left='+((screen.width-650)/2) );
>
> }
>
>
> Now I now that the backing bean is being called as by log4j output shows
> that the setter method is being invoked
>
> public String getVar3Value() {
> String rtn="INITIALVALUE";
>
> if ( !firstTime ) {
> .....do some work...
> rtn="value from doing work";
> }
>
> return rtn;
> }
>
> Everything works all the way to the return statement. However the new value
> never gets reflected in the client.
> The client just stays at the initial value which was set within getVar3Value
> the first time the code was called.
> I have debug within the if block so I can see exactly what is getting
> called, the client just never updates the value .
>
> Also, I tried a hyperlink on the screen as per the examples within woodstock
> and I expected to see the hyperlink change however, nothing happens.
>
>
> Anyhelp appreciated.
>
> Thanks
>
> ( Ps Im using nearly all of the woodstock components within this application
> so im quite used to the syntax and model )
>
>
>
>
>
>
>
> Venkatesh Babu-5 wrote:
>
>> Could you show the code snippet for the ajax refresh you are doing.
>> How are you updating the server side data and doing the label refresh.
>>
>> -Venky
>>
>> stuartr wrote:
>>
>>> Guys
>>> Im having a problem with any of the textfield, hidden , hyperlink etc to
>>> allow for ajax refresh.
>>> My code has an onclick which updates the server side, and then invokes a
>>> refresh on a label
>>> I have on the screen. Basically, the code at the back end bean gets
>>> invoked
>>> to get the new value
>>> for the label, and using firebug I can see the request.
>>> However, nothing happens at the client side. the label just never changes
>>> its value.
>>>
>>> Im using facelets along with my woodstock components.
>>>
>>>
>>> Stu
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Dan Labrecque wrote:
>>>
>>>
>>>> The prototype was available in the Woodstock milestone builds, but is
>>>> disabled for the official 4.1 release. It will be enabled again in the
>>>> 4.2 milestone builds as we complete the widget.
>>>>
>>>> Dan
>>>>
>>>> Lking wrote:
>>>>
>>>>
>>>>> Thanks Dan.
>>>>>
>>>>> Is this "table2" available for trying?
>>>>>
>>>>>
>>>>>
>>>>> On Nov 21, 2007 6:46 PM, Dan Labrecque <Dan.Labrecque_at_sun.com
>>>>> <mailto:Dan.Labrecque_at_sun.com>> wrote:
>>>>>
>>>>> Not all components support this API -- please see the TLD for
>>>>> supported
>>>>> JavaScript features. There is a table2 component in the works
>>>>> which is
>>>>> fully Ajax enabled and supports the refresh feature.
>>>>>
>>>>> Dan
>>>>>
>>>>> Lking wrote:
>>>>> > How can I get a client-side update with the Table component?
>>>>> > I was trying something like...
>>>>> >
>>>>> >
>>>>>
>>>>> onChange="document.getElementById('form1:table1').refresh('form1:textfield1');"
>>>>> >
>>>>> > but it doesn't work.
>>>>> >
>>>>> > thanks.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
>>>>> <mailto:users-unsubscribe_at_woodstock.dev.java.net>
>>>>> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>>>>> <mailto:users-help_at_woodstock.dev.java.net>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
>>>> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>