Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

View: New views
11 Messages — Rating Filter:   Alert me  

Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

by Mike Duffy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have implemented a sortable table with the <t:dataTable/> tag.  It's very cool.  Thx to those
who worked on this.

I am not a JavaScript guru, so I am having some trouble with something that should be very basic:
My sortable table is near the bottom of my page.  After the page refreshes. I'd like to
automatically scroll back to the table.

Any suggestions?

Mike

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 

Re: Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

by Mike Kienenberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you've enabled the AUTOSCROLL parameter in your web.xml file, you
should be seeing javascript generated like the following for each
command-link/command-button.

onclick="clear__5FtagId1_5F2();document.forms['_tagId1_2'].elements['autoScroll'].value=getScrolling();document.forms['_tagId1_2'].elements['_tagId1_2:_link_hidden_'].value='_tagId1_2:showAttachmentStatusableWorkList';if(document.forms['_tagId1_2'].onsubmit){var
result=document.forms['_tagId1_2'].onsubmit();  if( (typeof result ==
'undefined') || result )
{document.forms['_tagId1_2'].submit();}}else{document.forms['_tagId1_2'].submit();}return
false;"

The javascript below sets the current element (generally a
command-link) as the location to scroll to when the page reloads.

document.forms['yourFormId'].elements['autoScroll'].value=getScrolling();

Unfortunately, I haven't figured out how to make it scroll to any
arbitrary component on the page, but I'd think just enabling the
parameter should make it scroll back to your sorting link.

    <context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
        <description>
            If true, a javascript function will be rendered that is
able to restore the
            former vertical scroll on every request. Convenient
feature if you have pages
            with long lists and you do not want the browser page to
always jump to the top
            if you trigger a link or button action that stays on the same page.
            Default: "false"
        </description>
    </context-param>


On 12/19/05, Mike Duffy <mduffy_lists@...> wrote:

> I have implemented a sortable table with the <t:dataTable/> tag.  It's very cool.  Thx to those
> who worked on this.
>
> I am not a JavaScript guru, so I am having some trouble with something that should be very basic:
> My sortable table is near the bottom of my page.  After the page refreshes. I'd like to
> automatically scroll back to the table.
>
> Any suggestions?
>
> Mike
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Parent Message unknown RE: Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

by Matias Gomez Carabias :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've done this in a Struts Based Proyect, but I used javascript on the
onload, here's the deal:


I had to scroll to different parts of the page depending on the method
called (Struts' DispatchAction) on the method I set the action string in
the request to identify where it was called from, and then used a
JavaScript function to find the object to scroll to depending on the
action

Hope that helps.

Matias


<input  type="hidden" name="action"
value="<%=request.getParameter("method")%>">

<body  onload="javascript: collateralGroupSubmit ();">




function collateralGroupSubmit() {
       
var returnAction = document.getElementById("action").value;
       
var error = document.getElementById("error");
       
if((returnAction == "deleteCollateralGroup" ||returnAction ==
"getCollateralGroup" || returnAction == "modifyCollateralGroup" ||
returnAction == "addCollateralGroup") && error == null ) {
               
        var obj = document.getElementById('collateralGroupEdition');
               
        window.scrollTo(findPosX(obj), findPosY(obj)) ;
               
        }

}



function findPosX(obj)
{
        var curleft = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curleft += obj.offsetLeft
                        obj = obj.offsetParent;
                }
        }
        else if (obj.x)
                curleft += obj.x;
        return curleft;
}

function findPosY(obj)
{
        var curtop = 0;
        var printstring = '';
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curtop += obj.offsetTop
                        obj = obj.offsetParent;
                }
        }
        else if (obj.y)
                curtop += obj.y;
        return curtop;
}


-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@...]
Sent: Tuesday, December 20, 2005 12:54 PM
To: MyFaces Discussion
Subject: Re: Sort Table - Page Refreshes - Then Auto Scroll Back to the
Table

If you've enabled the AUTOSCROLL parameter in your web.xml file, you
should be seeing javascript generated like the following for each
command-link/command-button.

onclick="clear__5FtagId1_5F2();document.forms['_tagId1_2'].elements['aut
oScroll'].value=getScrolling();document.forms['_tagId1_2'].elements['_ta
gId1_2:_link_hidden_'].value='_tagId1_2:showAttachmentStatusableWorkList
';if(document.forms['_tagId1_2'].onsubmit){var
result=document.forms['_tagId1_2'].onsubmit();  if( (typeof result ==
'undefined') || result )
{document.forms['_tagId1_2'].submit();}}else{document.forms['_tagId1_2']
.submit();}return
false;"

The javascript below sets the current element (generally a
command-link) as the location to scroll to when the page reloads.

document.forms['yourFormId'].elements['autoScroll'].value=getScrolling()
;

Unfortunately, I haven't figured out how to make it scroll to any
arbitrary component on the page, but I'd think just enabling the
parameter should make it scroll back to your sorting link.

    <context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
        <description>
            If true, a javascript function will be rendered that is
able to restore the
            former vertical scroll on every request. Convenient
feature if you have pages
            with long lists and you do not want the browser page to
always jump to the top
            if you trigger a link or button action that stays on the
same page.
            Default: "false"
        </description>
    </context-param>


On 12/19/05, Mike Duffy <mduffy_lists@...> wrote:
> I have implemented a sortable table with the <t:dataTable/> tag.  It's
very cool.  Thx to those
> who worked on this.
>
> I am not a JavaScript guru, so I am having some trouble with something
that should be very basic:
> My sortable table is near the bottom of my page.  After the page
refreshes. I'd like to

> automatically scroll back to the table.
>
> Any suggestions?
>
> Mike
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

JSTL + JSF question

by Jeremy Sager :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys -

Thanks in advance for any answers :)

I need to iterate over something in one of my JSPs that is a list maintained
in a session scoped JSF bean.

I am trying to use this JSTL tag:

<c:forEach var="children" items="$editorPanelBean.list">

Is this legal?  Or do I need to do something complicated like using a JSP
scriptlet to get my request parameters and go digging for the map?

Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
JSager@...


Re: JSTL + JSF question

by Matthias Wessendorf-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

doesn't work

use facelets or glassfish (jsp 2.1)



On 12/20/05, Jeremy Sager <jsager@...> wrote:

> Hi guys -
>
> Thanks in advance for any answers :)
>
> I need to iterate over something in one of my JSPs that is a list maintained
> in a session scoped JSF bean.
>
> I am trying to use this JSTL tag:
>
> <c:forEach var="children" items="$editorPanelBean.list">
>
> Is this legal?  Or do I need to do something complicated like using a JSP
> scriptlet to get my request parameters and go digging for the map?
>
> Jeremy Sager
> Data Communications Product Manager
> Chesapeake System Solutions
> 410.356.6805 x120
> JSager@...
>
>


--
Matthias Wessendorf
Zülpicher Wall 12, 239
50674 Köln
http://www.wessendorf.net
mwessendorf-at-gmail-dot-com

Re: JSTL + JSF question

by Mike Kienenberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unless you're using facelets, you're going to have difficulty using
c:forEach with JSF.

Maybe you can use t:dataList instead?   The difference is that
c:forEach operates at component tree build time and dataList operates
at render time, but for most use cases, that doesn't make any
difference to the end-developer.

On 12/20/05, Jeremy Sager <jsager@...> wrote:

> Hi guys -
>
> Thanks in advance for any answers :)
>
> I need to iterate over something in one of my JSPs that is a list maintained
> in a session scoped JSF bean.
>
> I am trying to use this JSTL tag:
>
> <c:forEach var="children" items="$editorPanelBean.list">
>
> Is this legal?  Or do I need to do something complicated like using a JSP
> scriptlet to get my request parameters and go digging for the map?
>
> Jeremy Sager
> Data Communications Product Manager
> Chesapeake System Solutions
> 410.356.6805 x120
> JSager@...
>
>

Re: JSTL + JSF question

by Wale Ernie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Assuming your JSF bean is called editorPanelBean and it's in the session

You can get access to it using the following
<c:forEach var="children" items="${sessionScope.editorPanelBean.list}">

so you don't have to use a scriplet in this scenario.

Re: JSTL + JSF question

by Matthias Wessendorf-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://www.onjava.com/pub/a/onjava/2004/06/09/jsf.html

this is a good article on the issue.

On 12/20/05, Matthias Wessendorf <mwessendorf@...> wrote:

> doesn't work
>
> use facelets or glassfish (jsp 2.1)
>
>
>
> On 12/20/05, Jeremy Sager <jsager@...> wrote:
> > Hi guys -
> >
> > Thanks in advance for any answers :)
> >
> > I need to iterate over something in one of my JSPs that is a list maintained
> > in a session scoped JSF bean.
> >
> > I am trying to use this JSTL tag:
> >
> > <c:forEach var="children" items="$editorPanelBean.list">
> >
> > Is this legal?  Or do I need to do something complicated like using a JSP
> > scriptlet to get my request parameters and go digging for the map?
> >
> > Jeremy Sager
> > Data Communications Product Manager
> > Chesapeake System Solutions
> > 410.356.6805 x120
> > JSager@...
> >
> >
>
>
> --
> Matthias Wessendorf
> Zülpicher Wall 12, 239
> 50674 Köln
> http://www.wessendorf.net
> mwessendorf-at-gmail-dot-com
>


--
Matthias Wessendorf
Zülpicher Wall 12, 239
50674 Köln
http://www.wessendorf.net
mwessendorf-at-gmail-dot-com

Re: JSTL + JSF question

by Alexandre Poitras :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One friendly advice, use facelets or Shale-Clay or you'll go throught
a lot of pain if you use JSP as your view technology. It has several
integration issues with JSF.


On 12/20/05, Matthias Wessendorf <mwessendorf@...> wrote:

> http://www.onjava.com/pub/a/onjava/2004/06/09/jsf.html
>
> this is a good article on the issue.
>
> On 12/20/05, Matthias Wessendorf <mwessendorf@...> wrote:
> > doesn't work
> >
> > use facelets or glassfish (jsp 2.1)
> >
> >
> >
> > On 12/20/05, Jeremy Sager <jsager@...> wrote:
> > > Hi guys -
> > >
> > > Thanks in advance for any answers :)
> > >
> > > I need to iterate over something in one of my JSPs that is a list maintained
> > > in a session scoped JSF bean.
> > >
> > > I am trying to use this JSTL tag:
> > >
> > > <c:forEach var="children" items="$editorPanelBean.list">
> > >
> > > Is this legal?  Or do I need to do something complicated like using a JSP
> > > scriptlet to get my request parameters and go digging for the map?
> > >
> > > Jeremy Sager
> > > Data Communications Product Manager
> > > Chesapeake System Solutions
> > > 410.356.6805 x120
> > > JSager@...
> > >
> > >
> >
> >
> > --
> > Matthias Wessendorf
> > Zülpicher Wall 12, 239
> > 50674 Köln
> > http://www.wessendorf.net
> > mwessendorf-at-gmail-dot-com
> >
>
>
> --
> Matthias Wessendorf
> Zülpicher Wall 12, 239
> 50674 Köln
> http://www.wessendorf.net
> mwessendorf-at-gmail-dot-com
>


--
Alexandre Poitras
Québec, Canada

Re: Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

by Mike Duffy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thx Mike.

I've enabled the AUTO_SCROLL in my web.xml.

The scroll back behavior is still not working.  Is there anything else I need to do?

I see the onclick scroll functions for the sortable columns in my data table.  Is the scroll back
funtionality enabled by just setting AUTO_SCROLL to true in the web.xml?

Mike



--- Mike Kienenberger <mkienenb@...> wrote:

> If you've enabled the AUTOSCROLL parameter in your web.xml file, you
> should be seeing javascript generated like the following for each
> command-link/command-button.
>
>
onclick="clear__5FtagId1_5F2();document.forms['_tagId1_2'].elements['autoScroll'].value=getScrolling();document.forms['_tagId1_2'].elements['_tagId1_2:_link_hidden_'].value='_tagId1_2:showAttachmentStatusableWorkList';if(document.forms['_tagId1_2'].onsubmit){var

> result=document.forms['_tagId1_2'].onsubmit();  if( (typeof result ==
> 'undefined') || result )
> {document.forms['_tagId1_2'].submit();}}else{document.forms['_tagId1_2'].submit();}return
> false;"
>
> The javascript below sets the current element (generally a
> command-link) as the location to scroll to when the page reloads.
>
> document.forms['yourFormId'].elements['autoScroll'].value=getScrolling();
>
> Unfortunately, I haven't figured out how to make it scroll to any
> arbitrary component on the page, but I'd think just enabling the
> parameter should make it scroll back to your sorting link.
>
>     <context-param>
>         <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
>         <param-value>true</param-value>
>         <description>
>             If true, a javascript function will be rendered that is
> able to restore the
>             former vertical scroll on every request. Convenient
> feature if you have pages
>             with long lists and you do not want the browser page to
> always jump to the top
>             if you trigger a link or button action that stays on the same page.
>             Default: "false"
>         </description>
>     </context-param>
>
>
> On 12/19/05, Mike Duffy <mduffy_lists@...> wrote:
> > I have implemented a sortable table with the <t:dataTable/> tag.  It's very cool.  Thx to
> those
> > who worked on this.
> >
> > I am not a JavaScript guru, so I am having some trouble with something that should be very
> basic:
> > My sortable table is near the bottom of my page.  After the page refreshes. I'd like to
> > automatically scroll back to the table.
> >
> > Any suggestions?
> >
> > Mike
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>



               
__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


Re: Sort Table - Page Refreshes - Then Auto Scroll Back to the Table

by Martin Marinschek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, that should be enough.

There was a bug I recently fixed though in the auto-scroll behaviour.
Maybe you want to try a recent nightly?

regards,

Martin

On 12/26/05, Mike Duffy <mduffy_lists@...> wrote:

> Thx Mike.
>
> I've enabled the AUTO_SCROLL in my web.xml.
>
> The scroll back behavior is still not working.  Is there anything else I need to do?
>
> I see the onclick scroll functions for the sortable columns in my data table.  Is the scroll back
> funtionality enabled by just setting AUTO_SCROLL to true in the web.xml?
>
> Mike
>
>
>
> --- Mike Kienenberger <mkienenb@...> wrote:
>
> > If you've enabled the AUTOSCROLL parameter in your web.xml file, you
> > should be seeing javascript generated like the following for each
> > command-link/command-button.
> >
> >
> onclick="clear__5FtagId1_5F2();document.forms['_tagId1_2'].elements['autoScroll'].value=getScrolling();document.forms['_tagId1_2'].elements['_tagId1_2:_link_hidden_'].value='_tagId1_2:showAttachmentStatusableWorkList';if(document.forms['_tagId1_2'].onsubmit){var
> > result=document.forms['_tagId1_2'].onsubmit();  if( (typeof result ==
> > 'undefined') || result )
> > {document.forms['_tagId1_2'].submit();}}else{document.forms['_tagId1_2'].submit();}return
> > false;"
> >
> > The javascript below sets the current element (generally a
> > command-link) as the location to scroll to when the page reloads.
> >
> > document.forms['yourFormId'].elements['autoScroll'].value=getScrolling();
> >
> > Unfortunately, I haven't figured out how to make it scroll to any
> > arbitrary component on the page, but I'd think just enabling the
> > parameter should make it scroll back to your sorting link.
> >
> >     <context-param>
> >         <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
> >         <param-value>true</param-value>
> >         <description>
> >             If true, a javascript function will be rendered that is
> > able to restore the
> >             former vertical scroll on every request. Convenient
> > feature if you have pages
> >             with long lists and you do not want the browser page to
> > always jump to the top
> >             if you trigger a link or button action that stays on the same page.
> >             Default: "false"
> >         </description>
> >     </context-param>
> >
> >
> > On 12/19/05, Mike Duffy <mduffy_lists@...> wrote:
> > > I have implemented a sortable table with the <t:dataTable/> tag.  It's very cool.  Thx to
> > those
> > > who worked on this.
> > >
> > > I am not a JavaScript guru, so I am having some trouble with something that should be very
> > basic:
> > > My sortable table is near the bottom of my page.  After the page refreshes. I'd like to
> > > automatically scroll back to the table.
> > >
> > > Any suggestions?
> > >
> > > Mike
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam protection around
> > > http://mail.yahoo.com
> > >
> >
>
>
>
>
> __________________________________________
> Yahoo! DSL – Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces