<ej:ComboBox ID="cmbEmployerLocation" runat="server" Width="300px" DataTextField="ContactName" DataValueField="SupplierID" Placeholder="Select a state">
<DataManager URL="https://js.syncfusion.com/ejServices/wcf/NorthWind.svc/" CrossDomain="true"></DataManager>
</ej:ComboBox>
<br />
<ej:Button runat="server" Type="Button" Text="Change Query" ClientSideOnClick="QueryChange"></ej:Button>
<script>
function QueryChange(args)
{
var employerLocationObj = $('#<%= cmbEmployerLocation.ClientID %>').data("ejComboBox");
employerLocationObj.setModel({
query: ej.Query().from('Suppliers').select('SupplierID', 'ContactName').take(10),
actionComplete: function (arg) {
if (arg.result.length > 0) {
preValue = arg.result[0].SupplierID;
listObj1 = $('#<%=cmbEmployerLocation.ClientID%>').ejComboBox("instance");
this.setModel({ value: preValue });
}
}
});
}
</script> |
<script>
function QueryChange(args) {
var employerLocationObj = $('#<%= cmbEmployerLocation.ClientID %>').data("ejComboBox");
employerLocationObj.setModel({
query: ej.Query().from('Suppliers').select('SupplierID', 'ContactName').take(10),
actionComplete: function (arg) {
if (arg.result.length > 0) {
this.setModel({ index: 0 });
}
}
});
}
</script> |