Hi ,
Thanks for you reply. I remove my method hideAddButton() from
phoneListView
then I create a new ajaxcallbackbutton method to carry your code like below
public Button getLimitedPartialRefreshAddButton(String id, final int
limited) {
return new AjaxFallbackButton(id, null) {
/** Default serial id */
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isEnabledInHierarchy();
}
@Override protected void onConfigure () {
super.onConfigure();
setVisible (getList().size() < limited);
}
@Override
protected void onSubmit(AjaxRequestTarget target,
Form<?> form) {
List<T> targetList =
PartialUpdateListView.this.getModelObject();
targetList.add(createNewItem());
if (target != null) {
setResponsePage(getPage());
}
}
}.setDefaultFormProcessing(false);
}
then add this button in the phoneViewList :
newPhone.add(phoneListView.getLimitedPartialRefreshAddButton("addNewPhone",
ADD_MORE_LIMIT_TWO));
the button is not hidden when I add phone panel twice.
any suggestion ?
<http://apache-wicket.1842946.n4.nabble.com/file/n4678274/2017-07-24_10_52_35-Los_Angeles_Department_of_Public_Social_Services_YourBenefitsNow.png>
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/how-to-hide-the-AjaxFallbackButton-when-the-number-of-Models-is-larger-than-a-specific-integer-tp4678266p4678274.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]