|
<script type="text/javascript">
ej.DropDownList.prototype._onActionComplete=function(args)
{
var proxy = this,searchQuery;
this._queryString = this.inputSearch.val();
if(!args.searchQuery)
{
searchQuery = this._addSearchQuery(ej.Query(), !this._isPlainType(this._rawList));
}
else
{
searchQuery =args.searchQuery;
};
var args = { searchString: this._queryString, items: this._rawList, searchQuery: searchQuery };
if(ej.DataManager && this._dataSource() instanceof ej.DataManager && this.model.enableServerFiltering && (window.getSelection().type == "Caret" || ej.browserInfo().name == "msie" )){
var searchQuery = args.searchQuery.clone();
var queryPromise = proxy._dataSource().executeQuery(searchQuery);
queryPromise.done(function (e) {
proxy._filterSearch(args.searchQuery, e);
});
}
else{
proxy._filterSearch(searchQuery, args);
}
};
var customerList = ej.DataManager({url:"https://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Customers", crossDomain: true});
var matches=[];
var controlProperty =
{
dataSource: customerList ,
fields : { text: "ContactName", value: 'CustomerID' },
itemsCount : 10 ,
popupHeight: "200px",
width: "250px",
enableFilterSearch: true,
enableServerFiltering: true,
search:"onsearch",
actionComplete:"oncomplete"
};
$(function () {
$('#customerList').ejDropDownList(controlProperty);
});
function onsearch(args)
{
args.searchQuery= ej.Query().select("ContactName", "CustomerID").where(ej.Predicate("ContactName", ej.FilterOperators.contains, args.searchString, true).or("CustomerID", ej.FilterOperators.contains, args.searchString, true));
}
</script> |