-
1. Re: Unable to access DOM objects with jQuery using id
sergeysmirnov Jan 31, 2008 4:33 PM (in response to vst777)In the example at http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf the id is used, but not the class. So, your post made me wondered.
-
2. Re: Unable to access DOM objects with jQuery using id
sergeysmirnov Jan 31, 2008 4:35 PM (in response to vst777)Could you say what exactly the id of the table if you look at the browser source code?
-
3. Re: Unable to access DOM objects with jQuery using id
vst777 Feb 1, 2008 1:35 PM (in response to vst777)Oh. That's correct. Using the id in the selector works well. But working with the id in the query attribute fails. Try this sample:
<rich:dataTable id="myTable" styleClass="myTableStyle" .... > <rich:jQuery ... query="click(function(){jQuery('#myTable tr').addClass('active_row')})" />
Btw my form has id="myForm" so the client id would be 'myForm:myTable'. Also trying jQuery('#myForm:myTable tr') or jQuery('#myForm\\:myTable tr') fails. -
4. Re: Unable to access DOM objects with jQuery using id
sergeysmirnov Feb 1, 2008 1:37 PM (in response to vst777)You are speaking about RichFaces 3.1.4GA, are not you?
-
5. Re: Unable to access DOM objects with jQuery using id
sergeysmirnov Feb 1, 2008 2:14 PM (in response to vst777)RichFaces tries to associate the content of the 'selector' attribute with possible JSF component id. However, RichFaces does not parse and tries to hack your javascript code. I.e. if you use jQuery(....) directly, it is you responsibility to put the correct selector there.
Actually, you can use jQuery(this) if it is the same object that mentioned in the selector. Otherwise, jQuery('#myForm\\:myTable tr') should work. Look at the source code in the browser and make sure that nothing eats the "\\" in the final code.