|
<h3>Parent Dropdown</h3>
<ejs-dropdownlist #ddlelement2 id='ddlelement2' [dataSource]="countryData"[fields]="countryFields" (change)="countryChange()" placeholder = 'Select a game'></ejs-dropdownlist>
|
|
// initialize Custom DropDownList component
this.dropDownListObject = new DropDownList({
placeholder: "Select PlaceHolder Value",
width: "180px",
fields: { text: 'StateName', value: "SateId" },
//set the data to dataSource property
dataSource: this.placeHolderdata
});
this.dropDownListObject.appendTo('#ddlelement');
}
//Parent dropdown change event
public countryChange(): void {
let tempQuery: Query = new Query().where('CountryId', 'equal', this.countryObj.value);
this.dropDownListObject.query = tempQuery;
this.dropDownListObject.text = null;
this.dropDownListObject.dataBind();
}
|
|
public countryData: { [key: string]: Object }[] = [
{ CountryName: 'Australia', CountryId: '2' },
{ CountryName: 'United States', CountryId: '1' }
];
//define the state DropDownList data
public placeHolderdata: { [key: string]: Object }[] = [
{ StateName: 'US state -1', CountryId: '1', SateId: '101' },
{ StateName: 'US state -2 ', CountryId: '1', SateId: '102' },
{ StateName: 'Australia State -1 ', CountryId: '2', SateId: '105' },
{ StateName: 'Australia State -2', CountryId: '2', SateId: '106' },
{ StateName: 'US state -3 ', CountryId: '1', SateId: '108' },
{ StateName: 'Australia State -3 ', CountryId: '2', SateId: '109' },
{ StateName: 'url', SateId: 'url',CountryId: '0'},
{ StateName: 'userid', SateId: 'userid',CountryId: '0'},
{ StateName: 'username.loginemail', SateId: 'username.loginemail',CountryId: '0'},
{ StateName: 'emailotp', SateId: 'emailotp', EntityId:0 ,CountryId: '0' },
{ StateName: 'emailotpvalidaity', SateId: 'emailotpvalidaity',CountryId: '0' },
{ StateName: 'password', SateId: 'password',CountryId: '0' }
]; |