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&lt;ContactPhone>> contactPhoneList = new
PropertyModel<List&lt;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() {
                                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]

Reply via email to