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
Maya,
As per my understanding, the request parameters will be sent to the server and response will be received by the client based on matching textKey i.e. the filtering will happen on textKey field only. Is it possible to filter the result-set based on multiple fields? I am using ItemTemplate of Combo in which I am displaying the data from 3 fields. And, when user types into the combo, I want to fetch the records which match any of these three fields. Is this possible? If yes, please guide how I can configure such igCombo.
Thanks,
Jatin.
Hello Sharon ,
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
https://es.infragistics.com/support
Hello Gila,
You can get the query string from the request like this:
HttpContext.Current.Request.QueryString
That will return the query the combo has initiated in oData format.
In your case it seems that the text key is resolved runtime:
textKey: itemText
However if for example the textKey is “Name” and you enter a value of “1” in the input element of the combo this will generate the following query string:
filter(Name)=contains(1)
This will also be the value of HttpContext.Current.Request.QueryString
Based on that you can filter manually your data and return only the results that fulfill that requirement.
Let me know if you have any question.
Developer Support Engineer II
http://es.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,
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.
www.infragistics.com/support