You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Boyce, Keith Garry" <Ke...@bcbsma.com> on 2005/04/29 20:54:08 UTC

Javascript errors with x:commandSortHeader

This message is a PRIVATE communication.
If you are not the intended recipient, please do not read, copy,
or use it, and do not disclose it to others. Please notify the
sender of the delivery error by replying to this message, and then
delete it from your system. Thank you.

Re: Javascript errors with x:commandSortHeader

Posted by Sean Schofield <se...@gmail.com>.
I am not an expert on x:commandSortHeader but I do think you are right
about the stuff being autogenerated.  Basically the clickable headers
are h:commandLinks.  Because the command links need to support events,
they basically require javascript.

Suppose you click on the HTML link generated by h:commandLink.  It
will post back to the JSF page that generated it.  How will JSF know
that you clicked on that particular link as opposed to another link? 
Both links would post back to the same JSF page.  The answer is that a
system of hidden inputs and javascript are used.  This is the only way
to do it AFAIK.  The RI does something similar as well.

So that explains where your hidden fields, etc. are coming from.  I
can't explain why you are experiencing a javascript error.  Try
looking at the simple examples in the latest CVS (or nightly
downloads).  There are a few new examples there.

The lack of documentation is a problem that we are slowly working on. 
Please feel free to contribute some documentation or examples that you
think might help others.

sean


On 4/29/05, Boyce, Keith Garry <Ke...@bcbsma.com> wrote:
>  
>  
>  
>  
> 
> I am attempting to use x:commandSortHeader but when I click on the header I
> get javascript error. In looking at code I see.clear__5Fid0() which doesn't
> exist in my html and _id0:_link_hidden_ also which doesn't exist. I expect
> that these are autogenerated but they don't show up. What could the reason
> be? 
> 
> I see no documentation to explain this. In the example app I see a bunch of
> code but I don't understand where it is coming from. 
>  
> 
> <form id="linkDummyForm" name="linkDummyForm" style="display:inline"
> method="post" action="/examples/sortTable.jsf"><input
> type="hidden" name="autoScroll"/><input type="hidden"
> name="linkDummyForm:_link_hidden_"/><input type="hidden"
> name="jscook_action"/><script type="text/javascript"> 
> 
> <!-- 
> function clear_linkDummyForm() { 
>   var f = document.forms['linkDummyForm']; 
>   f.elements['linkDummyForm:_link_hidden_'].value=null; 
>   f.elements['jscook_action'].value=null; 
>   f.target=''; 
> } 
> clear_linkDummyForm(); 
> //--> 
> </script></form> 
> <script language="JavaScript"> 
> <!-- 
> function getScrolling() { 
>     x = 0; y = 0; 
>     if (document.body && document.body.scrollLeft &&
> !isNaN(document.body.scrollLeft)) { 
>         x = document.body.scrollLeft; 
>     } else if (window.pageXOffset && !isNaN(window.pageXOffset)) { 
>         x = window.pageXOffset; 
>     } 
>     if (document.body && document.body.scrollTop &&
> !isNaN(document.body.scrollTop)) { 
>         y = document.body.scrollTop; 
>     } else if (window.pageYOffset && !isNaN(window.pageYOffset)) { 
>         y = window.pageYOffset; 
>     } 
>     return x + "," + y; 
> } 
> //--> 
> </script> 
> This message is a PRIVATE communication.
> If you are not the intended recipient, please do not read, copy,
> or use it, and do not disclose it to others. Please notify the
> sender of the delivery error by replying to this message, and then
> delete it from your system. Thank you.
> 
>