Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
605
igCombo load on demand set initial value
posted

Hi,

I'm using igCombo in an MVC Razor view, configured with remote filtering and load on demand:

@(@Html.Infragistics()
.ComboFor(model => model.CompanyID)
.DataSourceUrl(Url.Action("GetCompanies"))
.TextKey("Name")
.ValueKey("ID")
.FilteringType(ComboFilteringType.Remote)
.FilterExprUrlKey("filter")
.LoadOnDemandSettings(load => load.Enabled(true).PageSize(10))
.ResponseDataKey("Records")
.DelayFilteringOnKeyUp(500)
.ResponseTotalRecCountKey("TotalRecordsCount")
.ID("companyCombo")
.Render())

This works mostly, but I have a problem: when the initial value of the Company combo is not in the first 10 companies returned by the remote request, the initial value of the combo is not set, it remains empty.

I checked in the page source that the MVC wrappers correctly sets the initialSelectedElements list to the correct ID in the model.

In the reference: http://help.infragistics.com/jQuery/2015.2/ui.igcombo#options:initialSelectedItems

I read that: "Note: Only items loaded on initialization can be selected. When load-on-demand attempt to select not loaded item will fail."

Ok, fair enough, only the loaded elements can be selected, so that's why it works for the first 10 companied, and not for the rest.

My question is, how can I load this specific element to be selected? So I'd like to load the first 10 elements AND the one that should be initially selected. Would this approach work? If not, how can I set the inital element without loading up all Company entities (there are thousands of them, this is why I use remote filtering and load on demand in the first place)

regards,

Peter