Hi ig web teamI think the below is not normal.i have created Combo1 and combo2 with default selected value selectedItems: [{ index: 0 }] for each of them and it is has no problems in loading.
in the begining of the page
$.ig.loader(function (){
i try to get the selected value of each of them in this way
$("#combo1").igCombo("value")but it doesn’t return any value
I tried to create the combos in the top of the page before I get the values but actually it doesn’t matter where you create them, the same problem when you select the value.
I solved this in 2 ways:1- to get selected value in this way
$("#combo1").on("igcombodatabound", function (evt, ui) {
Here you can get the value
2- To delay the execution of this part for even 0
setTimeout(function () {
$("#combo1").igCombo("value")
}, 0);
I solved the problem in these ways but I just want to know why you render the code of creating the combo in long time or in a specific area in the page which I can’t get selected value of course in that time.Please more clarification needed.Thank youAL
Here is the code i wish if someone can just have alook and put a reply !!
@using Infragistics.Web.Mvc
@{
}
<script>
$.ig.loader({
scriptPath: '@Url.Content("~/Infragistics/js/")',
cssPath: '@Url.Content("~/Infragistics/css/")',
resources: 'igCombo'
});
$.ig.loader(function () {
var combo1val;
var combo2val;
combo1val = $("#combo1").igCombo("value");
combo2val = $("#combo2").igCombo("value");
$.post('@Url.Action("GetJsonData")', { param1: combo1val, param2: combo2val }, function (dataSource) {
createdatasource(dataSource);
})
Code to create data source here …….
And bind for some control
…………………………………..
</script>
<table>
<tr>
<td >combo1</td>
<td>
@(Html.Infragistics().Combo()
.ID("combo1")
.ValueKey("Value")
.TextKey("Text")
.Width("200px")
.DataSource(Url.Action("GetJsonCombo1data"))
.EnableClearButton(false)
.AllowCustomValue(false)
.Mode(ComboMode.DropDown)
.SelectedIndexes(new [] {0})
.DataBind()
.Render()
)
</td>
<td >combo2</td>
.ID("combo2")
.DataSource(Url.Action("GetJsonCombo2data"))
</tr>
</table>
Hi, AL Adam.
The igLoader loads all the configured resources asynchronously. The callback function for the loader is fired as soon as all the required resources are downloaded. At this time the Java Script file is downloaded, but this doesn't mean that the code itself is executed. It just start execution and in the same time you are trying to access the igCombo. That's why when you try to get igCombo value in the loader callback function, you don't have it. And the only place where you can be sure the igCombo is loaded as in the igcombodatabound event. That's the reason the event is created. When you are sure that jQuery is loaded you use it's callback function, the same is here - when you sure the combo is loaded you can use its callback and access the combo. The thing here is that igLoader callback doesn't ensure that the controls (igCombo) are loaded, it ensures their scripts are downloaded. Using the event is recommended and you made it the right way.
If you have more questions, don't hesitate to ask them.
Best regards,
Nikolay Alipiev