You need to sign in to do that
Don't have an account?

Row number of focused row in PageBlockTable using jQuery
How do I get the row number back from my PageBlockTable with javascript or jQuery? I’ve tried a few methods, but they always return [object Object].
I am displaying repeating elements in a PageBlockTable. When I change the contents of Field1, I want to perform a calculation in my controller, and place the cursor in Field2.
Yes, I know the scripting looks like I'm lost - I am.
<apex:page controller="TestTabbingController" id="PageId"> <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.8.2.min.js')}" /> <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.24.custom.min.js')}" /> <apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.24.custom.css')}" /> <script type="text/javascript"> j$ = jQuery.noConflict(); function putErThereDude() { var myRow = j$('[id*=PageBlockTableId]'); alert("myRow is " + myRow) ; var Part1 = "PageId:FormId:PageBlockId:PageBlockSectionId:PageBlockTableId:"; var myRow = j$('[id*=PageBlockTableId]'); var Part3 = ":Field2" ; var PutIt = Part1 + myRow + Part3; alert("PutIt is " + PutIt) ; var myElement = document.getElementById(PutIt); alert("myElement is " + myElement) ; j$(myElement).focus(); } </script> <apex:form id="FormId"> <apex:PageBlock title="Confirmation" id="PageBlockId"> <apex:PageBlockSection title="GPS Print Products" id="PageBlockSectionId" columns="1" > <apex:pageBlockTable value="{!OpportunitiesWithIndex}" var="oppWrapped" style="width:100%" id="PageBlockTableId"> <apex:column headerValue="Name" Id="GPSD_Name"> <apex:outputLabel value="{!oppWrapped.opp.name}" id="Name" > </apex:outputLabel> </apex:column> <apex:column headerValue="Field 1" Id="GPSD_Field1"> <apex:inputField value="{!oppWrapped.opp.X_Field_1__c}" id="Field1" > <apex:actionSupport event="onchange" action="{!doSomething}" reRender="PageBlockSectionId" oncomplete="putErThereDude(event.target.focus())" /> </apex:inputField> </apex:column> <apex:column headerValue="Field 2" Id="GPSD_Field2"> <apex:inputField value="{!oppWrapped.opp.X_Field_2__c}" id="Field2" > <apex:actionSupport event="onchange" action="{!doSomething}" reRender="PageBlockSectionId" /> </apex:inputField> </apex:column> <apex:column headerValue="Field 3" Id="GPSD_Field3"> <apex:inputField value="{!oppWrapped.opp.X_Field_3__c}" id="Field3" > <apex:actionSupport event="onchange" action="{!doSomething}" reRender="PageBlockSectionId" /> </apex:inputField> </apex:column> <apex:column headerValue="Field 4" Id="GPSD_Field4"> <apex:inputField value="{!oppWrapped.opp.X_Field_4__c}" id="Field4" > </apex:inputField> </apex:column> </apex:pageBlockTable> </apex:PageBlockSection> </apex:PageBlock> </apex:form> </apex:page>
Did you get the solution for this