@@ -243,17 +243,11 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
243243 }
244244 }
245245
246- // for convenience, we provide the property "editor" as an Angular-Slickgrid editor complex object
246+ // for convenience to the user , we provide the property "editor" as an Angular-Slickgrid editor complex object
247247 // however "editor" is used internally by SlickGrid for it's own Editor Factory
248248 // so in our lib we will swap "editor" and copy it into a new property called "internalColumnEditor"
249249 // then take back "editor.model" and make it the new "editor" so that SlickGrid Editor Factory still works
250- this . _columnDefinitions = this . _columnDefinitions . map ( ( column : Column | any ) => {
251- // on every Editor that have a "collectionAsync", resolve the data and assign it to the "collection" property
252- if ( column . editor && column . editor . collectionAsync ) {
253- this . loadEditorCollectionAsync ( column ) ;
254- }
255- return { ...column , editor : column . editor && column . editor . model , internalColumnEditor : { ...column . editor } } ;
256- } ) ;
250+ this . _columnDefinitions = this . swapInternalEditorToSlickGridFactoryEditor ( this . _columnDefinitions ) ;
257251
258252 // save reference for all columns before they optionally become hidden/visible
259253 this . sharedService . allColumns = this . _columnDefinitions ;
@@ -699,6 +693,9 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
699693 * If using i18n, we also need to trigger a re-translate of the column headers
700694 */
701695 updateColumnDefinitionsList ( newColumnDefinitions ) {
696+ // map/swap the internal library Editor to the SlickGrid Editor factory
697+ newColumnDefinitions = this . swapInternalEditorToSlickGridFactoryEditor ( newColumnDefinitions ) ;
698+
702699 if ( this . gridOptions . enableTranslate ) {
703700 this . extensionService . translateColumnHeaders ( false , newColumnDefinitions ) ;
704701 } else {
@@ -748,6 +745,22 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
748745 }
749746 }
750747
748+ /**
749+ * For convenience to the user, we provide the property "editor" as an Angular-Slickgrid editor complex object
750+ * however "editor" is used internally by SlickGrid for it's own Editor Factory
751+ * so in our lib we will swap "editor" and copy it into a new property called "internalColumnEditor"
752+ * then take back "editor.model" and make it the new "editor" so that SlickGrid Editor Factory still works
753+ */
754+ private swapInternalEditorToSlickGridFactoryEditor ( columnDefinitions : Column [ ] ) {
755+ return columnDefinitions . map ( ( column : Column | any ) => {
756+ // on every Editor that have a "collectionAsync", resolve the data and assign it to the "collection" property
757+ if ( column . editor && column . editor . collectionAsync ) {
758+ this . loadEditorCollectionAsync ( column ) ;
759+ }
760+ return { ...column , editor : column . editor && column . editor . model , internalColumnEditor : { ...column . editor } } ;
761+ } ) ;
762+ }
763+
751764 /**
752765 * Update the Editor "collection" property from an async call resolved
753766 * Since this is called after the async call resolves, the pointer will not be the same as the "column" argument passed.
0 commit comments