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

Issue with visualforce component ID
Hi All,
Below is my sample code:
Page:-
<apex:page sidebar="false" controller="sampleCtrl">
<apex:dataTable id="example" value="{!numbers}" var="number">
<apex:column >
<apex:facet name="header">Numbers</apex:facet>
{!number}
</apex:column>
</apex:dataTable>
</apex:page>
Controller:-
public with sharing class sampleCtrl {
public List<String> numbers { get; set; }
public sampleCtrl()
{
numbers = new List<String>();
numbers.add('One');
numbers.add('Two');
numbers.add('Three');
}
}
Issue here is:
I have declared the id of the dataTable as 'example' but it becomes 'j_id0:example'.
Is there any way to eliminate this prior string of example in the id?
Thanks.
it will append all the previous tags ids .. if you specified id you will get that other wise like j_id0 , j_id1 so on.....
Thanks for you reply.
can you please suggest any way to eliminate the appended string in the id?
where exactly u are using that id and y u need to eliminate ?
This id 'example' is used in jQuery. We dont have permissions to change the js files.
We should use only id as 'example'.
the id u r getting is not from <apex:dataTable id="example" value="{!numbers}" var="number"> this?.. i dont think so... you are getting that formatted id for the above component only
I tried as below, getting the id of dataTable only:
<apex:dataTable id="example" value="{!numbers}" var="number"
onclick="alert('pageId:'+{!$Component.pageId}.id+' Id: '+this.id);">
Can you please check it.