11import React , { useCallback , useState } from 'react' ;
2- import { ODataStore , CustomStore } from 'devextreme-react/common/data' ;
2+ import { CustomStore } from 'devextreme-react/common/data' ;
33import { Autocomplete , type AutocompleteTypes } from 'devextreme-react/autocomplete' ;
44import 'whatwg-fetch' ;
55import { names , surnames , positions } from './data.ts' ;
6+ import AspNetData from 'devextreme-aspnet-data-nojquery' ;
67
78function isNotEmpty ( value : string ) {
89 return value !== undefined && value !== null && value !== '' ;
@@ -11,11 +12,9 @@ function isNotEmpty(value: string) {
1112const positionLabel = { 'aria-label' : 'Position' } ;
1213const position = positions [ 0 ] ;
1314
14- const states = new ODataStore ( {
15- version : 2 ,
16- url : 'https://js.devexpress.com/Demos/DevAV/odata/States?$select=Sate_ID,State_Long,State_Short' ,
17- key : 'Sate_ID' ,
18- keyType : 'Int32' ,
15+ const states = AspNetData . createStore ( {
16+ loadUrl : 'https://js.devexpress.com/Demos/NetCore/api/DataGridStatesLookup' ,
17+ key : 'ID' ,
1918} ) ;
2019
2120const clientsStore = new CustomStore ( {
@@ -42,7 +41,7 @@ const clientsStore = new CustomStore({
4241
4342const renderState = ( data ) => (
4443 < span >
45- { data . State_Long } ({ data . State_Short } )
44+ { data . Name } ({ data . Short } )
4645 </ span >
4746) ;
4847
@@ -131,7 +130,7 @@ function App() {
131130 < Autocomplete
132131 dataSource = { states }
133132 value = { state }
134- valueExpr = "State_Long "
133+ valueExpr = "Name "
135134 onValueChanged = { handleStateChange }
136135 placeholder = "Type state name..."
137136 itemRender = { renderState }
0 commit comments