The hidden fields are showing up and the javascript is working in the
example applications. The problem is that when I create my own page and
put the components in there the autogenerated JavaScript stuff shows up
in the onclick for the sort header but the hidden fields aren't there.
If you follow this link (BTW: I'd appreciate if you give some feedback
on that issue too) most of the code for the app is there except that at
that time I didn't use myfaces components.
Here is a snippet of current jsp code..
<body>
<f:view>
<h:form>
<x:dataTable
style="width:250"
styleClass="disp"
id="topicSelections"
rows="#{TopicSelections.pagingNumberPer}"
value="#{TopicSelections}"
var="contactUsTopic"
sortColumn="#{TopicSelections.sortColumn}"
sortAscending="#{TopicSelections.ascending}"
preserveDataModel="true"
preserveSort="true"
>
<h:column>
<f:facet name="header">
<x:commandSortHeader columnName="topicName">
<h:outputText value="Topic Name" />
</x:commandSortHeader>
</f:facet>
<h:outputText id="topicName" value="#{contactUsTopic.topicName}"/>
</h:column>
-----Original Message-----
From: Sean Schofield [mailto:[EMAIL PROTECTED]
Sent: Friday, April 29, 2005 4:30 PM
To: MyFaces Discussion
Subject: Re: Javascript errors with x:commandSortHeader
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 <[EMAIL PROTECTED]> 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.
>
>
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.