Hi Tobias,

thanks! Can the isVisible method be directly overridden also by  a 
ResourceLink?  

ResourceLink pl = new ResourceLink(..) {
protected boolean isVisible() {…}
}
Chris


> Am 09.05.2015 um 19:46 schrieb Tobias Soloschenko 
> <[email protected]>:
> 
> Hi,
> 
> the constructor of your panel is only called at a normal request - you have 
> to set the visibility of your link in the ajax callback via AjaxRequestTarget.
> 
> 1. setOutputMarkupId and setOutputMarkupPlaceholder of the link to true (in 
> your constructor)
> 
> 2. set the visibility to your component in the callback method (based on your 
> Model)
> 
> 3. add the component to the AjaxRequestTarget so that it is updated 
> 
> Another solution would be to override the isVisible method and return the 
> visibility based on your model and then only add the component to the 
> AjaxRequestTarget.
> 
> kind regards
> 
> Tobias
> 
>> Am 09.05.2015 um 19:29 schrieb Chris <[email protected]>:
>> 
>> Hi all,
>> 
>> currently, the visibility of the resource link is not updated when the 
>> parent component of the panel is rendered again based on an ajax call.
>> 
>> How can the visibility set dynamically based on the model’s data?
>> 
>> Thanks, Chris
>> 
>> public SomePanel(String id, final IModel<List<A>> model) {
>> super(id, model);
>> 
>> ResourceLink pl = new ResourceLink("pdfLink", new 
>> ByteArrayResource("application/pdf") {...}
>> pl.setVisible(routingModel.getObject().get(0).getElements().size() > 0);
>> ...
>> }
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to