webtier@glassfish.java.net

Re: How to get rowIndex from woodstock table component by JavaScript?

From: <webtier_at_javadesktop.org>
Date: Thu, 30 Sep 2010 01:45:16 PDT

Just in case if someone hardly find the solution.

For Woodstock table component return kind of funny rowIndex. Every rows are counted inclusive Header. So, what you need to do is that create a javascript function a following;
function rowIndex(key){
    var row = key.rowIndex - 2;
    //alert(eval(row));
    return eval(row);
}

See, the "-2". which in return you the current working row.

Next, the "parentNode". you need to find the parent in order to obtain the rowindex during the runtime. In my case, I have...5 levels.
"form1:ajaxZone1:table1:tblrowgp_sodetailbill:tableColumn5".

Therefore, I need to place following script:
onChange="DynaFaces.fireAjaxTransaction(this, {execute: 'tf_exchg',render: 'form1:ajaxZone1:table1:tblrowgp_sodetailbill:'+eval(rowIndex(this.parentNode.parentNode.parentNode.parentNode.parentNode))+':tableColumn5:tf_qty'});"

..and everything just working fine.

Everyone is welcome to further advise or provide better solutions. No doubt Woodstock components are EOL and advise to migrate to ICEface, I hope it will helps.

regard,
jose
[Message sent by forum member 'airqq']

http://forums.java.net/jive/thread.jspa?messageID=484002