@@ -10,12 +10,12 @@ const DEFAULT_MAX_VALUE = 100;
10
10
const DEFAULT_STEP = 1 ;
11
11
12
12
export class SliderEditor implements Editor {
13
+ private _defaultValue = 0 ;
13
14
private _elementRangeInputId : string ;
14
15
private _elementRangeOutputId : string ;
15
16
private _$editorElm : any ;
16
17
private _$input : any ;
17
18
$sliderNumber : any ;
18
- defaultValue : any ;
19
19
originalValue : any ;
20
20
21
21
/** SlickGrid Grid object */
@@ -63,8 +63,8 @@ export class SliderEditor implements Editor {
63
63
64
64
// define the input & slider number IDs
65
65
const itemId = this . args && this . args . item && this . args . item . id ;
66
- this . _elementRangeInputId = `rangeInput_${ this . columnDef . field } _${ itemId } ` ;
67
- this . _elementRangeOutputId = `rangeOutput_${ this . columnDef . field } _${ itemId } ` ;
66
+ this . _elementRangeInputId = `rangeInput_${ this . columnDef . id } _${ itemId } ` ;
67
+ this . _elementRangeOutputId = `rangeOutput_${ this . columnDef . id } _${ itemId } ` ;
68
68
69
69
// create HTML string template
70
70
const editorTemplate = this . buildTemplateHtmlString ( ) ;
@@ -143,10 +143,10 @@ export class SliderEditor implements Editor {
143
143
if ( item && fieldName !== undefined ) {
144
144
// is the field a complex object, "address.streetNumber"
145
145
const isComplexObject = fieldName && fieldName . indexOf ( '.' ) > 0 ;
146
- let value = ( isComplexObject ) ? getDescendantProperty ( item , fieldName ) : item [ fieldName ] ;
146
+ let value = ( isComplexObject ) ? getDescendantProperty ( item , fieldName ) : ( item . hasOwnProperty ( fieldName ) ? item [ fieldName ] : this . _defaultValue ) ;
147
147
148
148
if ( value === '' || value === null || value === undefined ) {
149
- value = this . defaultValue ; // load default value when item doesn't have any value
149
+ value = this . _defaultValue ; // load default value when item doesn't have any value
150
150
}
151
151
this . originalValue = + value ;
152
152
this . _$input . val ( value ) ;
@@ -198,7 +198,7 @@ export class SliderEditor implements Editor {
198
198
const maxValue = this . columnEditor . hasOwnProperty ( 'maxValue' ) ? this . columnEditor . maxValue : DEFAULT_MAX_VALUE ;
199
199
const defaultValue = this . editorParams . hasOwnProperty ( 'sliderStartValue' ) ? this . editorParams . sliderStartValue : minValue ;
200
200
const step = this . columnEditor . hasOwnProperty ( 'valueStep' ) ? this . columnEditor . valueStep : DEFAULT_STEP ;
201
- this . defaultValue = defaultValue ;
201
+ this . _defaultValue = defaultValue ;
202
202
203
203
if ( this . editorParams . hideSliderNumber ) {
204
204
return `
0 commit comments