|
export class AppComponent {
public country: DataManager = new DataManager({
url: "https://services.odata.org/V4/Northwind/Northwind.svc/Customers",
adaptor: new ODataV4Adaptor(),
crossDomain: true
});
public query: Query = new Query()
.select(["CompanyName", "CustomerID"])
.take(10);
public state: DataManager = new DataManager({
url: "https://services.odata.org/V4/Northwind/Northwind.svc/Customers",
adaptor: new ODataV4Adaptor(),
crossDomain: true
});
public query1: Query = new Query()
.select(["ContactName", "CustomerID", "Country"])
.take(10)
.requiresCount();
// maps the country columns to fields property
public countryFields: Object = { value: "CustomerID", text: "CompanyName" };
// maps the state columns to fields property
public stateFields: Object = { value: "Country", text: "ContactName" };
// set the placeholder to DropDownList input element
public countryWaterMark: string = "Select a country";
public stateWaterMark: string = "Select a state";
@ViewChild("countryList")
// country DropDownList instance
public countryObj: DropDownListComponent;
@ViewChild("stateList")
// state DropDownList instance
public stateObj: MultiSelectComponent;
public onChange1(): void {
this.stateObj.enabled = true;
// query the data source based on country DropDownList selected value
let tempQuery: Query = new Query().where(
"CustomerID",
"equal",
this.countryObj.value
);
this.stateObj.query = tempQuery;
// clear the existing selection.
this.stateObj.text = null;
// bind the property changes to state DropDownList
this.stateObj.dataBind();
}
}
|