You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Nigel P. Weymont" <we...@comcast.net> on 2014/10/17 19:57:00 UTC

Return to an html id on a response page

Can somebody point me in the right direction with the following? 

I have the following scenario: I have a link from Page A to Page B. On page B a search is performed and the results are presented in a DataView. The user clicks on a row to select the result and is returned to Page A. 

I would like the user to be returned to a specific html id on Page A rather than the top of the page but I am not sure how to do this. 

These are the pertinent details as currently implemented: 

I am using a submit button to link to Page B (named NpiSearch) from page A (named Documentation) and the following: 

setResponsePage( new NpiSearch(Documentation. this )); 

to link from Page A to page B so that I can return to Page A when I am finsihed with Page B. 

public NpiSearch( final Page returnTo) {... 

// display search results 
final DataView<IDataProvider<Object>> dataView..... 

public void populateItem( final Item item) {… 

// display the search results details..for example 
item.add( new Label( "lastName" , jsonNpiSearchDTO.getLastName())); 

// select line and return to documentation page 
final AjaxEventBehavior selectNpi = new AjaxEventBehavior( "onclick" ) { 

@ Override 
protected void onEvent(AjaxRequestTarget target) { 
setResponsePage(returnTo); 
} 
} 
} 
} 

In other parts of the application I am using code such as: 

finishButton.add( new AttributeAppender( "href" , "#diagnosis" )); 

But obviously this does not work in the code above. 

So how do I return to a specific id after selecting a line in the DataView? 

Any pointers would be great. 

Nigel 


Re: Return to an html id on a response page

Posted by Nigel W <we...@gmail.com>.
Thank you Sven, I will take a look at these,

Nigel

On Fri, Oct 17, 2014 at 4:27 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> you should not keep references from one page to other pages, use a
> PageReference instead.
>
> See the following for some ideas on how to scroll to an anchor:
>
> http://stackoverflow.com/questions/14436899/how-to-add-anchor-in-wickets-
> setresponsepage
>
> Regards
> Sven
>
>
>
> On 10/17/2014 07:57 PM, Nigel P. Weymont wrote:
>
>> Can somebody point me in the right direction with the following?
>>
>> I have the following scenario: I have a link from Page A to Page B. On
>> page B a search is performed and the results are presented in a DataView.
>> The user clicks on a row to select the result and is returned to Page A.
>>
>> I would like the user to be returned to a specific html id on Page A
>> rather than the top of the page but I am not sure how to do this.
>>
>> These are the pertinent details as currently implemented:
>>
>> I am using a submit button to link to Page B (named NpiSearch) from page
>> A (named Documentation) and the following:
>>
>> setResponsePage( new NpiSearch(Documentation. this ));
>>
>> to link from Page A to page B so that I can return to Page A when I am
>> finsihed with Page B.
>>
>> public NpiSearch( final Page returnTo) {...
>>
>> // display search results
>> final DataView<IDataProvider<Object>> dataView.....
>>
>> public void populateItem( final Item item) {…
>>
>> // display the search results details..for example
>> item.add( new Label( "lastName" , jsonNpiSearchDTO.getLastName()));
>>
>> // select line and return to documentation page
>> final AjaxEventBehavior selectNpi = new AjaxEventBehavior( "onclick" ) {
>>
>> @ Override
>> protected void onEvent(AjaxRequestTarget target) {
>> setResponsePage(returnTo);
>> }
>> }
>> }
>> }
>>
>> In other parts of the application I am using code such as:
>>
>> finishButton.add( new AttributeAppender( "href" , "#diagnosis" ));
>>
>> But obviously this does not work in the code above.
>>
>> So how do I return to a specific id after selecting a line in the
>> DataView?
>>
>> Any pointers would be great.
>>
>> Nigel
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Return to an html id on a response page

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you should not keep references from one page to other pages, use a 
PageReference instead.

See the following for some ideas on how to scroll to an anchor:

http://stackoverflow.com/questions/14436899/how-to-add-anchor-in-wickets-setresponsepage

Regards
Sven


On 10/17/2014 07:57 PM, Nigel P. Weymont wrote:
> Can somebody point me in the right direction with the following?
>
> I have the following scenario: I have a link from Page A to Page B. On page B a search is performed and the results are presented in a DataView. The user clicks on a row to select the result and is returned to Page A.
>
> I would like the user to be returned to a specific html id on Page A rather than the top of the page but I am not sure how to do this.
>
> These are the pertinent details as currently implemented:
>
> I am using a submit button to link to Page B (named NpiSearch) from page A (named Documentation) and the following:
>
> setResponsePage( new NpiSearch(Documentation. this ));
>
> to link from Page A to page B so that I can return to Page A when I am finsihed with Page B.
>
> public NpiSearch( final Page returnTo) {...
>
> // display search results
> final DataView<IDataProvider<Object>> dataView.....
>
> public void populateItem( final Item item) {…
>
> // display the search results details..for example
> item.add( new Label( "lastName" , jsonNpiSearchDTO.getLastName()));
>
> // select line and return to documentation page
> final AjaxEventBehavior selectNpi = new AjaxEventBehavior( "onclick" ) {
>
> @ Override
> protected void onEvent(AjaxRequestTarget target) {
> setResponsePage(returnTo);
> }
> }
> }
> }
>
> In other parts of the application I am using code such as:
>
> finishButton.add( new AttributeAppender( "href" , "#diagnosis" ));
>
> But obviously this does not work in the code above.
>
> So how do I return to a specific id after selecting a line in the DataView?
>
> Any pointers would be great.
>
> Nigel
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org