views:

1033

answers:

2

Hi Guys, I have a rich:dataTable. I want to hide a row with this code:

<c:if test="#{not empty documents &amp;&amp; documents.size!=0}">
    <rich:jQuery selector="#_inboxTable_ tr"
        query="ready(function() {
            jQuery.noConflict();
            if ( jQuery(this).find('checkboxStatus').attr('checked', true)) {
                new Effect.Fade(jQuery(this));
            }
        })"
    />
</c:if>

The problem is that i receive: element.getInlineOpacity is not a function error....

I was initially supposing that I cannot hide a row with this Fade effect but I have made a simple other table and all was working ok...

Can you give me a clue on this issue?

A: 
element.getInlineOpacity is not a function

I've never seen this before, so I Googled a bit. And what turns out? It look like that you're (at least, under the hood) mixing jQuery with Prototype or Scriptaculous and that the whole thing is colliding with each other.

Cleanup it and retry.

Edit as others already pointed out, you need to replace the non-jQuery thing new Effect.Fade() by the jQuery fadeOut() function.

BalusC
hi Balus. I have already seen that on google, that's why i used jQuery.noConflict(); and replace $ with jQuery....and something else: with the same code but with other simple table (not rich:dataTable) the code is working.....
Cristian Boariu
You should not mix functions of different JS libraries with each other. Keep them separate. If you want to use jQuery, use **only** jQuery specific functions and so on.
BalusC
Hi Balus. I've tried with fadeOut(), but i receive no error and nothing is happening...<c:if test="#{not empty documents })" /></c:if>
Cristian Boariu
Debug the code. What does `find('checkboxStatus').length` and `closest('tr').length` say? Zero or one? If zero, then it simply isn't there.
BalusC
Finally works! Thanks
Cristian Boariu
A: 

Effect.fade isn't jquery code which is probably causing you problems. Especially since you are passing it a jquery object. You could try passing it the raw DOM element instead e.g.

if ( jQuery(this).find('checkboxStatus').attr('checked', true)) {
    new Effect.Fade(this);
}

Then again, I'm not sure exactly what this whole rich table thing is... Or exactly what you are trying to do... Do you want to fade out any table row with a checked checkbox in it? What is checkboxStatus? Is it a class (in which case there should be a . in the above code)?

Depending what you are trying to do, something like this might be a more jQuery approach:

jQuery(this).find('.checkboxStatus:checked').parent('tr').fadeOut();
vitch
What i want is to hide all the rows which contain a checkbox checked with the id checkBoxStatus, after the page is rendered.
Cristian Boariu
rich:dataTable is a component from RichFaces, which in turn is a JSF component library, which in turn is a Java component based MVC framework.
BalusC
If you want to search for things with an id of checkBoxStatus you will need to `find('#checkBoxStatus')`. However, it sounds like you have multiple elements with the same id on your page which is invalid and likely to cause you plenty of problems...
vitch
Multiple client elements with same ID is impossible in JSF. So this is likely not the root cause.
BalusC