Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ADF 11g: Iterating through table in JavaScript

Joonas Linkola-OracleDec 11 2009 — edited Dec 11 2009
Hi,

Using JDeveloper 11.1.1.2.0. I have several tables where I need to display a calculated sum of values in a column beneath the table with the calculated values updating dynamically on value changes. I could do this in a backing bean but communicating with the server on each value change (ie. using the arrows on a spinbox) would be quite inefficient. I added a client listener to the input field and was able to get the handle to the table in JavaScript but am completely lost on how to iterate over the rows and calculate the sum.

This is the code I have so far, based on [Frank“s JavaScript tips|http://thepeninsulasedge.com/frank_nimphius/adf-faces-rich-client-javascript-programming/] :
// event is a valueChangeEvent from the input field
function calculateSum(event) {
                var _theTable = event.getSource().getParent();
                var sum = 0; 
                for(var i = 0; i < _theTable.getRows(); i++){
                    // what to do here???
                    sum += ?someRowVar?.findComponent("percentage").getValue();  
                }
                var total = _theTable.findComponent("totalSum");
                totalSum.setValue(sum);
Can I get the RowKeySet for the table somehow?

Any suggestions?

Regards,

Joonas
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2010
Added on Dec 11 2009
3 comments
1,406 views