@@ -75,8 +75,7 @@ export default {
7575
7676			formOptions:  { 
7777				validateAfterLoad:  true , 
78- 				validateAfterChanged:  true , 
79- 				validateBeforeSave:  true  
78+ 				validateAfterChanged:  true  
8079			} 
8180		}; 
8281	}, 
@@ -118,7 +117,7 @@ export default {
118117		}, 
119118
120119		onValidated (res , errors ) { 
121- 			console .log (" VFG validated:"  
120+ 			console .log (" onValidated  VFG validated:" ,  arguments , res, errors); 
122121		}, 
123122
124123		generateModel () { 
@@ -145,32 +144,36 @@ export default {
145144		}, 
146145
147146		saveModel () { 
148- 			console .log (" Save model..."  
149- 			if  (this .formOptions .validateBeforeSave  ===  false  ||  this .validate ()) { 
150- 				this .mergeModelValues (); 
151- 
152- 				if  (this .isNewModel ) { 
153- 					this .rows .push (this .model ); 
154- 					this .selectRow (null , this .model , false ); 
147+ 			console .log (" Save model..." this .validate , typeof  this .validate ); 
148+ 			this .validate ().then ( 
149+ 				(test ) =>  { 
150+ 					console .log (" saveModel"  
151+ 					this .mergeModelValues (); 
152+ 
153+ 					if  (this .isNewModel ) { 
154+ 						this .rows .push (this .model ); 
155+ 						this .selectRow (null , this .model , false ); 
156+ 					} 
157+ 				}, 
158+ 				(error ) =>  { 
159+ 					//  Validation error 
160+ 					console .warn (" Error saving model..."  
155161				} 
156- 			} else  { 
157- 				console .warn (" Error saving model..."  
158- 				//  Validation error 
159- 			} 
162+ 			); 
160163		}, 
161164
162165		mergeModelValues () { 
163166			let  model =  this .model ; 
164167			if  (model &&  this .selected .length  >  0 ) { 
165- 				each (this .selected , row  =>  { 
168+ 				each (this .selected , ( row )  =>  { 
166169					merge (row, model); 
167170				}); 
168171			} 
169172		}, 
170173
171174		deleteModel () { 
172175			if  (this .selected .length  >  0 ) { 
173- 				each (this .selected , row  =>  { 
176+ 				each (this .selected , ( row )  =>  { 
174177					let  index =  this .rows .indexOf (row); 
175178					this .rows .splice (index, 1 ); 
176179				}); 
@@ -181,15 +184,16 @@ export default {
181184		getNextID () { 
182185			let  id =  0 ; 
183186
184- 			each (this .rows , row  =>  { 
187+ 			each (this .rows , ( row )  =>  { 
185188				if  (row .id  >  id) id =  row .id ; 
186189			}); 
187190
188191			return  ++ id; 
189192		}, 
190193
191194		validate () { 
192- 			//  console.log("validate", this.$refs.form, this.$refs.form.validate()); 
195+ 			console .log (" APP validate" this .$refs .form , typeof  this .$refs .form .validate ); 
196+ 
193197			return  this .$refs .form .validate (); 
194198		}, 
195199
@@ -199,7 +203,7 @@ export default {
199203
200204		getLocation (model ) { 
201205			if  (navigator .geolocation ) { 
202- 				navigator .geolocation .getCurrentPosition (pos  =>  { 
206+ 				navigator .geolocation .getCurrentPosition (( pos )  =>  { 
203207					if  (! model .address ) model .address  =  {}; 
204208					if  (! model .address .geo ) model .address .geo  =  {}; 
205209					model .address .geo .latitude  =  pos .coords .latitude .toFixed (5 ); 
0 commit comments