@@ -41,7 +41,7 @@ export default class Sample extends React.Component<any, any> {
4141 autoGenerate = { false }
4242 data = { this . worldCitiesAbove500K }
4343 primaryKey = "ID"
44- rendered = { this . webGridWithComboRendered } >
44+ onRendered = { this . webGridWithComboRendered } >
4545 < IgrColumn
4646 field = "ID"
4747 header = "ID"
@@ -98,53 +98,47 @@ export default class Sample extends React.Component<any, any> {
9898 }
9999 }
100100
101- public webGridWithComboRendered ( gridRef : IgrGrid , args : IgrVoidEventArgs ) {
102- gridRef . data = this . gridData ;
101+ public webGridWithComboRendered ( args : IgrVoidEventArgs ) {
102+ args . target . data = this . gridData ;
103103 }
104104
105- public onCountryChange ( rowId : string , cmp : any , args : any ) {
105+ public onCountryChange ( rowId : string , args : CustomEvent < any > ) {
106106 // find next combo
107- // args incomplete, so gte value from component on timeout as workaround.
108107 const regionCombo = this . comboRefCollection . get ( "region_" + rowId ) ;
109108 const cityCombo = this . comboRefCollection . get ( "city_" + rowId ) ;
110109 const regions = this . regions ;
111- setTimeout ( ( ) => {
112- const newValue = cmp . value [ 0 ] ;
113- if ( newValue === undefined ) {
114- regionCombo . deselect ( regionCombo . value ) ;
115- regionCombo . disabled = true ;
116- regionCombo . data = [ ] ;
117-
118- cityCombo . deselect ( regionCombo . value ) ;
119- cityCombo . disabled = true ;
120- cityCombo . data = [ ] ;
121- } else {
122- regionCombo . disabled = false ;
123- regionCombo . data = regions . filter ( x => x . Country === newValue ) ;
124-
125- cityCombo . deselect ( cityCombo . value ) ;
126- cityCombo . disabled = true ;
127- cityCombo . data = [ ] ;
128- }
129- } ) ;
110+ const newValue = args . detail . newValue [ 0 ] ;
111+ if ( newValue === undefined ) {
112+ regionCombo . deselect ( regionCombo . value ) ;
113+ regionCombo . disabled = true ;
114+ regionCombo . data = [ ] ;
115+
116+ cityCombo . deselect ( regionCombo . value ) ;
117+ cityCombo . disabled = true ;
118+ cityCombo . data = [ ] ;
119+ } else {
120+ regionCombo . disabled = false ;
121+ regionCombo . data = regions . filter ( x => x . Country === newValue ) ;
122+
123+ cityCombo . deselect ( cityCombo . value ) ;
124+ cityCombo . disabled = true ;
125+ cityCombo . data = [ ] ;
126+ }
130127 }
131128
132- public onRegionChange ( rowId : string , cmp : any , args : any ) {
129+ public onRegionChange ( rowId : string , args : CustomEvent < any > ) {
133130 // find next combo
134- // args incomplete
135131 const cityCombo = this . comboRefCollection . get ( "city_" + rowId ) ;
136132 const cities = this . cities ;
137- setTimeout ( ( ) => {
138- const newValue = cmp . value [ 0 ] ;
139- if ( newValue === undefined ) {
140- cityCombo . deselect ( cityCombo . value ) ;
141- cityCombo . disabled = true ;
142- cityCombo . data = [ ] ;
143- } else {
144- cityCombo . disabled = false ;
145- cityCombo . data = cities . filter ( x => x . Region === newValue ) ;
146- }
147- } ) ;
133+ const newValue = args . detail . newValue [ 0 ] ;
134+ if ( newValue === undefined ) {
135+ cityCombo . deselect ( cityCombo . value ) ;
136+ cityCombo . disabled = true ;
137+ cityCombo . data = [ ] ;
138+ } else {
139+ cityCombo . disabled = false ;
140+ cityCombo . data = cities . filter ( x => x . Region === newValue ) ;
141+ }
148142 }
149143
150144 public webGridCountryDropDownTemplate = ( props : { dataContext : IgrCellTemplateContext } ) => {
@@ -157,7 +151,7 @@ export default class Sample extends React.Component<any, any> {
157151 const comboId = "country" + id ;
158152 return (
159153 < >
160- < IgrCombo data = { this . countries } ref = { ( this as any ) . comboRefs } change = { ( x : any , args : any ) => { ( this as any ) . onCountryChange ( id , x , args ) } } placeholder = "Choose Country..." valueKey = "Country" displayKey = "Country" singleSelect = { true } name = { comboId } > </ IgrCombo >
154+ < IgrCombo data = { this . countries } ref = { ( this as any ) . comboRefs } onChange = { ( args : any ) => { ( this as any ) . onCountryChange ( id , args ) } } placeholder = "Choose Country..." valueKey = "Country" displayKey = "Country" singleSelect = { true } name = { comboId } > </ IgrCombo >
161155 </ >
162156 ) ;
163157 }
@@ -173,7 +167,7 @@ export default class Sample extends React.Component<any, any> {
173167 return (
174168 < >
175169 < div style = { { display : "flex" , flexDirection : "column" } } >
176- < IgrCombo ref = { ( this as any ) . comboRefs } change = { ( x : any , args : any ) => { ( this as any ) . onRegionChange ( id , x , args ) } } placeholder = "Choose Region..." disabled = { true } valueKey = "Region" displayKey = "Region" singleSelect = { true } name = { comboId } >
170+ < IgrCombo ref = { ( this as any ) . comboRefs } onChange = { ( args : any ) => { ( this as any ) . onRegionChange ( id , args ) } } placeholder = "Choose Region..." disabled = { true } valueKey = "Region" displayKey = "Region" singleSelect = { true } name = { comboId } >
177171 </ IgrCombo >
178172 </ div >
179173 </ >
0 commit comments