Hello,
We had like to use igcombo with filtering against DB.
We are using durandal architecture, using knockout binding, and we had like to use the igcombo, and on each pree key go th apicontroller and bring the set from DB against the value that pressed.
And refresh the datasource of combo. We have saw there is type Remote, but didn't understand how to send the paramteres to the server .
Our example:
<span id="combo"
data-bind="igCombo: {dataSource: 'api/lookup/GetLookup?EmpNo=7&UserNo=9998&ElemName=PermGroup&PageNo=1&PageSize=100&PagingBy=false&SearchBy=2&SearchVal=1&SearchExact=true&OtherParamsXML='''
, width: '400px', valueKey: itemValue,
textKey: itemText , itemTemplate: displayMember ,
selectionChanged: selectionChangedFunction ,allowCustomValue: true,
filteringType: 'remote',
responseDataKey: 'd.results'
}"></span>
Can anybody help us?
Regards,
gila
Hello gila,
Thank you for posting in our forum.
When the filteringType is remote once you start typing in the combo the combo will make an ajax request to the remote data source to filter the data.
There are some additional properties you can set to determine the format of the request.
filterExprUrlKey - sets url key name that specifies how the remote filtering expressions will be encoded for remote requests. By default it uses oData.
filteringCondition – the condition based on which to filter. By default it is set to “contains”.
Based on these properties when you start typing the combo will initiate and ajax request with some additional parameters in the query string.
For example if you check the request in the browser initiated by the following sample at:
https://www.igniteui.com/combo/filtering
You’ll noticed that for example if you enter “a” in the combo the request made to the server will contain the query in oData format:
&filter(Name)=contains(a)
Where Name is the textKey field set for the combo:
$("#comboTargetDiv").igCombo({
textKey: "Name",
…
Which corresponds to the key in the data source the combo should use.
“contains” is the filtering condition which can be set via the filteringCondition property and “a” is the value entered.
If you’re using MVC as the back-end and your action has the ComboDataSourceAction attribute the combo will automatically filter the data based on the data source returned in the action.
Also if your remote data source supports oData request I will also be able to automatically parse the request and return the filtered data.
Otherwise you would need to manually handle the filtering by checking the Query string passed in the request , manually filter your data source based on that and return the resulting data in json format.
Let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
www.infragistics.com/support
Hello Maya,
first of all thanke for your nice reply.
Actually i didn't understand what shell i write in the properties when my ajax needs to get in ApiController (WebApi), and send it all kins of parameters.
my procedure in server side will send me bach through the api the wohle source by the filter.
MyApiController: (gets json of parameters)
[HttpGet] [ActionName("GetLookup")] public IQueryable<LookupDTO> Lookup(string query) { JavaScriptSerializer jss = new JavaScriptSerializer(); GetLookupDataQuery queryParams = new Helper().JsonToObject<GetLookupDataQuery>(query);
return new LookupRepository().GetLookupList(queryParams); }
My igcombo is what i have written you in first mail.
I had like if you could write me exactly the parameters & values i need to use.
thank u very much,