質問

I have multiple rows on a table and when i click on a button (ice:command Link) from one row i want to scroll to bottom of page. I tried to use a java script function on the on click event but the issue is that after the scroll go's down it comes right back to the button clicked.

function onclickToBottom()
{
     window.scrollTo(0, document.body.scrollHeight);
}

Is there a way to prevent that like an javascript event that would run after all icefaces javascript done executing ?? thanks !

役に立ちましたか?

解決

I guess you have an action listener for your ice:commandLink?. May be that's why you are experiencing such a behavior.

There are two options you can try.

  1. Use addJavascriptCall method of com.icesoft.faces.context.effects.JavascriptContext to call your script within the actionListener. This means, you shouldn't have an onclick script in your link.
  2. Use HTML anchor tag <a> instead of <ice:commandLink> and add your script call to onclick event. You can just style it using ICEfaces style classes.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top