You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Paul Klaer <pk...@infeurope.lu> on 2005/06/15 15:55:30 UTC

jsValueChangeListener + DataTable: onchange tag value is not correct

Hi *,

I'm using your sample application code for the jsValueChangeListener.

Now, using the jsValueChangeListener with DataTable I have some problems.

1st Problem:
- One row in a table with a dropdown and jsValuechangeListener.
- Add a second row to position index 0 and the new entry has a DropDown 
component tag rendered="false"
- Not normal now: The second DropDown component (index 1) tag 
onchange="orgApacheMyfacesJsListenerSetExpressionProperty...." has now 
the ids for index 0 and 1 for the onchange tag. I get now a JavaScript 
error because the first component is not rendered and therefore there is 
an error: "Object required, source-element: null." The JavaScript can't 
find the component on position 0. What is correct because the component 
is not rendered.

2nd:
Same problem appears if you set for both components rendered="true" and 
delete a row with a component from the DataTable. The "onchange" 
attribute still has an entry for the index 1 and causes a similar js 
error...

I think the problem is because of the (Class 
JsValueChangeListenerRenderer line 118) "value = oldValueStr + value;" 
wich is adding the old script to the new component value.

It seems that the jsValueChangeListener is not prepared for the use if 
the amount of components is changing. I could not found the line in the 
code for resetting the "onchange" value.

It is always adding the old value to the new value...

Can one of you tell me please the right usage of the code? Or am I right 
that the use of the jsValueChangeListener is not yet prepared for the 
DataTable with a changing amount of components?

Best Regards

Paul Klaer