PDA

View Full Version : How to setMinValue to a field being edited based on a previous field in a grid?



MikeB
10 Dec 2013, 7:52 AM
I'm stuck on a problem here. I have a standard Grid View with 2 timefields in the grid (a "StartTime" and an "EndTime"). I'm trying to figure out how to set the MinValue of the EndTime field based on the value of the "StartTime" field (standard End can't be before start concept).

Problem I'm having is that I can't seem to figure out how to get a handle to the timefield component of the EndTime cell from within the editor plugin in order to call the setMinValue() function.

Any help would be GREATLY appreciated.

Thanks
MikeB

evant
10 Dec 2013, 10:10 AM
Just declare your fields like:



var startField = new Ext.form.field.Text();
var endField = new Ext.form.field.Text();

// grid definition
columns: [{
editor: startField
}, {
editor: endField
}]


Then listen to the beforeedit event on the plugin and call setMin()/setMax() when appropriate.

MikeB
10 Dec 2013, 3:32 PM
That did the trick! Never thought of declaring the fields like that (I typically just declare them right in the view as an xtype).

MikeB