Hi,
On Jul 21, 2017 11:11 PM, "extraquoo" <[email protected]> wrote: here i have an AjaxFallbackButton to dynamically add new models of phone information My issue is that I want to hide this button if the models are added three times ( three phone number panels) here is my code. final PropertyModel<List<ContactPhone>> contactPhoneList = new PropertyModel<List<ContactPhone>>(mc216.getSection1(), "newContactPhone"); final PartialUpdateListView<ContactPhone> phoneListView = new PartialUpdateListView<ContactPhone>( "newContactPhone", contactPhoneList ,ContactPhone.class){ private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<ContactPhone> item) { final FormComponent<?>[] allFields = new FormComponent[3]; allFields[0] = new ReferenceTableDropDownChoice("contactPhone.type", new Model<Long>(), new Model<String>(), DOCUMENT_CATEGORY); allFields[1] = new FormTextField<String>("contactPhone.Number").setRequired(true).add(new PhoneValidator()); allFields[2] = new FormTextField<String>(" contactTime"); item.add(allFields); item.add(getPartialRefreshDeleteButton("delete", item)); item.add(new StyledFeedback("feedback", item)); } @Override public boolean hideAddButton() { I'm not sure what this method is but if you replace it with @Override protected void onConfigure () { super.onConfigure(); setVisible (getList().size() > 2); } And if you repaont the listview after adding and removing a phone then I guess it should work. if(contactPhoneList.getObject().size() > 2 ) { //TODO : hide the button return true; } else{ return false; } } }; newPhone.add(phoneListView.setReuseItems(true)); newPhone.add(phoneListView.getPartialRefreshAddButton(" addNewPhone")); newPhone.add(phoneListView); s1Border.add(newPhone); -- 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-tp4678266.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]
