@@ -109,7 +109,7 @@ You could also define certain options as a global level (for the entire grid or
109109
110110``` ts
111111this .gridOptions = {
112- defaultEditorOptions: {
112+ defaultEditorOptions: {
113113 autocompleter: { debounceWaitMs: 150 }, // typed as AutocompleterOption
114114 }
115115}
@@ -144,9 +144,10 @@ export class GridBasicComponent {
144144 fetch : (searchText , updateCallback ) => {
145145 // assuming your API call returns a label/value pair
146146 yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
147- .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]); })
148- .catch (error => console .log (' Error:' , error );
149- },
147+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
148+ .catch (error => console .log (' Error:' , error ));
149+ },
150+ }
150151 } as AutocompleterOption ,
151152 },
152153 ];
@@ -177,8 +178,9 @@ this.columnDefinitions = [
177178 fetch : (searchText , updateCallback ) => {
178179 // assuming your API call returns a label/value pair
179180 yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
180- .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]); })
181- .catch (error => console .log (' Error:' , error );
181+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
182+ .catch (error => console .log (' Error:' , error ));
183+ }
182184 },
183185 } as AutocompleterOption ,
184186 }
@@ -215,8 +217,9 @@ export class GridBasicComponent {
215217 minLength: 1 ,
216218 fetch : (searchText , updateCallback ) => {
217219 yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
218- .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]); })
219- .catch (error => console .log (' Error:' , error );
220+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
221+ .catch (error => console .log (' Error:' , error ));
222+ }
220223 },
221224 renderItem: {
222225 layout: ' twoRows' ,
@@ -281,7 +284,7 @@ export class GridBasicComponent {
281284 },
282285 fetch : (searchText , updateCallback ) => {
283286 yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
284- .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]); } )
287+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
285288 .catch (error => console .log (' Error:' , error );
286289 },
287290 renderItem : {
@@ -362,14 +365,10 @@ export class GridBasicComponent {
362365 editorOptions: {
363366 minLength: 3 , // minimum count of character that the user needs to type before it queries to the remote
364367 fetch : (searchText , updateCallback ) => {
365- $ .ajax ({
366- url: ' http://gd.geobytes.com/AutoCompleteCity' ,
367- dataType: ' jsonp' ,
368- data: {
369- q: searchText // geobytes requires a query with "q" queryParam representing the chars typed (e.g.: gd.geobytes.com/AutoCompleteCity?q=van
370- },
371- success : (data ) => updateCallback (data )
372- });
368+ // assuming your API call returns a label/value pair
369+ yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
370+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
371+ .catch (error => console .log (' Error:' , error ));
373372 }
374373 },
375374 },
@@ -382,16 +381,10 @@ export class GridBasicComponent {
382381 editorOptions: {
383382 minLength: 3 , // minimum count of character that the user needs to type before it queries to the remote
384383 fetch : (searchText , updateCallback ) => {
385- $ .ajax ({
386- url: ' http://gd.geobytes.com/AutoCompleteCity' ,
387- dataType: ' jsonp' ,
388- data: {
389- q: searchText
390- },
391- success : (data ) => {
392- updateCallback (data );
393- }
394- });
384+ // assuming your API call returns a label/value pair
385+ yourAsyncApiCall (searchText ) // typically you'll want to return no more than 10 results
386+ .then (result => updateCallback ((results .length > 0 ) ? results : [{ label: ' No match found.' , value: ' ' }]))
387+ .catch (error => console .log (' Error:' , error ));
395388 }
396389 },
397390 }
0 commit comments