Hi Martin,
Sorry for my late answer, I had not a lot of time... But here is my
solution.
You need to change only the method "callMethod" in the
JsValueChangeListenerRenderer Class. I added there an additional if clause.
Please check if the code runs well on your test environment... I used
the js name as marker and I check and clear the script entries on each
new row in a table or new parent component id....
Regards,
Paul Klaer
private void callMethod(UIComponent uiComponent, String propName, String
value)
{
Object oldValue = uiComponent.getAttributes().get(propName);
if(oldValue != null)
{
String oldValueStr = oldValue.toString().trim();
//check if method call has already been added...
if(oldValueStr.indexOf(value)!=-1)
return;
//check if multiple change listeners belong to parent
component
//and if the previous rendered information has to be cleared
if
(oldValueStr.indexOf("orgApacheMyfacesJsListenerSetExpressionProperty(")
> 0
&&
oldValueStr.indexOf(uiComponent.getClientId(getFacesContext())) < 0) {
oldValueStr = oldValueStr.substring(0,
oldValueStr.indexOf("orgApacheMyfacesJsListenerSetExpressionProperty("));
}
if(oldValueStr.length()>0 && !oldValueStr.endsWith(";"))
oldValueStr +=";";
value = oldValueStr + value;
}
uiComponent.getAttributes().put(propName, value);
}
Martin Marinschek wrote:
I don't have too much time, so if you want to give it a try, I would
be very thankful ;)
regards,
Martin
On 7/5/05, Paul Klaer <[EMAIL PROTECTED]> wrote:
Ah :-) I hope you had good days at java one... Thanks for your fast answer.
Yes, I think you're right, than we need a hole marker for this feature.
I think this is a good approach.
What do you think when you have time to extend the source code? If you
don't have much time maybe I could do try to implement this first and
send the code to you...
Regards
Martin Marinschek wrote:
Yes, I have seen it - sorry to not write back, I have been to the Java
One Conference in between.
I believe the thing with the marker is necessary - imagine you would
want to add a custom javascript function to the component
additionally, this would need to be in there always.
regards,
Martin
On 7/4/05, Paul Klaer <[EMAIL PROTECTED]> wrote:
Hi Martin,
sorry, I didn't answered very fast but did you noticed my mail in the
meantime on the users list?
Regards
Paul
Paul Klaer wrote:
I think the marker would be appropriate for this needs under this
conditions.
But, first time I saw the code I was asking me: Why do you need on each
component the call for the JS method of all components?
If a user changes a value for the component textbox then you always
change the hidden parameter (or something else) for this component, but
not for all other components...
Wouldn't be enough to have only one call for the js method
"orgApacheMyfacesJsListenerSetExpressionProperty...."?
Best Regards
Paul
Martin Marinschek wrote:
Yes,
you are absolutely right, that is a problem.
Sorry, I didn't have a need so far to fix that, and no time available
to do so right now, but I might have time to discuss it with you and
to try to find a solution.
One thing I was thinking about originally was to have this javascript
call surrounded by a marker and at the beginning of the encode end,
remove everything that is surrounded by this marker.
Would you think this approach is appropriate?
regards,
Martin