PDA

View Full Version : Validate form & grid



mjhaston
13 Apr 2013, 4:34 PM
I need to make sure that all required fields in a form and at least one row of a grid are valid so that I can enable a button that will add this data to another grid at the bottom of the page.

Users will populate the form in the top half of this page as well as populate at least one of the three rows of data in the middle grid. Once that happens I want to enable the buttom marked as "Add retirement scenario to que" which will add a row to that grid.

Previously I was able to listen for the validitychange and bind the button to the form, but now I've added the grid. Any ideas? I'm able to roll through the grid and check each row to validate that, but I'm not sure what to listen for to do that.

slemmon
15 Apr 2013, 10:29 AM
In your validitychange handler you might also do a check to see if grid.getStore().getCount (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.Store-method-getCount)() > 0.

mjhaston
15 Apr 2013, 1:07 PM
Good suggestion. I ended up doing that with my bottom grid. The first grid needed validations on it, so I end up scrolling through it to validate. Then users are allow to add scenarios to the bottom grid. That's where I was able to make use of your suggestion.

Thanks.