code: function() {
  		
  		var newvalues, record;
  		
  	  	//Validate the Form
  	  	if ( !this.dialog.getForm().validate() ) return ;
  	   
  		// Update the record
  		if(!this.insertNewRecord){
  						
  			// Update the row
  			newvalues = this.dialog.getValue();
  			this.datatable.updateRow( this.selectedRecord , newvalues );
  
  			// Get the new record
  			record = this.datatable.getRecord(this.selectedRecord);
  			
  			// Fire the modify event
           this.itemModifiedEvt.fire(record);
  
  		}
  		// Adding new record
  		else{
  			// Insert a new row
  	      this.datatable.addRow({});
  
  			// Set the Selected Record
  			var rowIndex = this.datatable.getRecordSet().getLength() - 1;
  			this.selectedRecord = rowIndex;
  			
  			// Update the row
  			newvalues = this.dialog.getValue();
  			this.datatable.updateRow( this.selectedRecord , newvalues );
  			
  			// Get the new record
  			record = this.datatable.getRecord(this.selectedRecord);
  						
  			// Fire the add event
           this.itemAddedEvt.fire(record);
  		}
        
        this.dialog.hide();
     }
docs: When saving the Dialog