Skip to main content

How to get rowIndex from woodstock table component by JavaScript?

1 reply [Last post]
Joined: 2009-02-01

Hi there,
Is there anyone experienced to read rowIndex from woodstock table component by using javascript? There isn't any good example from what I searched thru the web.

My woodstock component was wrapped with ajaxZone. The ajaxZone successfully sent to server and returned but couldn't get itself update to the correct texfield which reside in the respective table's row.

For Example,
onChange="DynaFaces.fireAjaxTransaction(this, {execute: 'tf_exchg',render: 'form1:ajaxZone1:table1:tblrowgp_sodetailbill:form1:rowIndex(this):tableColumn5:tf_qty'});"

The "rowIndex(this)" is what I tried to workaround and hopefully it translates into correct row index in order to render the value onto the respective textfield.

Appreciate if anyone of you can advise me. Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-02-01

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;
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.

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.