@@ -28,7 +28,7 @@ export class IntegerEditor implements Editor {
2828 }
2929
3030 get hasAutoCommitEdit ( ) {
31- return this . args . grid . getOptions ( ) . autoCommitEdit ;
31+ return this . args && this . args . grid && this . args . grid . getOptions && this . args . grid . getOptions ( ) . autoCommitEdit ;
3232 }
3333
3434 /** Get the Validator function, can be passed in Editor property or Column Definition */
@@ -70,7 +70,7 @@ export class IntegerEditor implements Editor {
7070 }
7171
7272 getColumnEditor ( ) {
73- return this . args && this . args . column && this . args . column . internalColumnEditor && this . args . column . internalColumnEditor ;
73+ return this . args && this . args . column && this . args . column . internalColumnEditor ;
7474 }
7575
7676 loadValue ( item : any ) {
@@ -80,7 +80,7 @@ export class IntegerEditor implements Editor {
8080 const fieldNameFromComplexObject = fieldName . indexOf ( '.' ) ? fieldName . substring ( 0 , fieldName . indexOf ( '.' ) ) : '' ;
8181
8282 if ( item && this . columnDef && ( item . hasOwnProperty ( fieldName ) || item . hasOwnProperty ( fieldNameFromComplexObject ) ) ) {
83- this . defaultValue = parseInt ( item [ fieldNameFromComplexObject || fieldName ] , 10 ) ;
83+ this . defaultValue = item [ fieldNameFromComplexObject || fieldName ] ;
8484 this . $input . val ( this . defaultValue ) ;
8585 this . $input [ 0 ] . defaultValue = this . defaultValue ;
8686 this . $input . select ( ) ;
@@ -92,7 +92,7 @@ export class IntegerEditor implements Editor {
9292 if ( elmValue === '' || isNaN ( elmValue ) ) {
9393 return elmValue ;
9494 }
95- return parseInt ( elmValue , 10 ) || 0 ;
95+ return isNaN ( elmValue ) ? elmValue : parseInt ( elmValue , 10 ) ;
9696 }
9797
9898 applyValue ( item : any , state : any ) {
@@ -105,13 +105,11 @@ export class IntegerEditor implements Editor {
105105
106106 isValueChanged ( ) {
107107 const elmValue = this . $input . val ( ) ;
108- const value = isNaN ( elmValue ) ? elmValue : parseInt ( elmValue , 10 ) ;
109108 const lastEvent = this . _lastInputEvent && this . _lastInputEvent . keyCode ;
110-
111109 if ( this . columnEditor && this . columnEditor . alwaysSaveOnEnterKey && lastEvent === KeyCode . ENTER ) {
112110 return true ;
113111 }
114- return ( ! ( value === '' && this . defaultValue === null && lastEvent !== KeyCode . ENTER ) ) && ( value !== this . defaultValue ) ;
112+ return ( ! ( elmValue === '' && this . defaultValue === null ) ) && ( elmValue !== this . defaultValue ) ;
115113 }
116114
117115 save ( ) {
0 commit comments