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
280
Binding Datasource to igCombo
posted

Hi,

    I am trying to bind a list to the igCombo. Although i notice my list does contain data, it is not show up in the igCombo. Please advise me on which part did i do it wrongly. Thanks.

   My code as below.

 

$(function () {


var WF_GetLogonAsListing1 = [];

$.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8;",
                url: "WF_Services.asmx/Delegate_GetLogonAs",
                data: "{'sUserId':'" + sLogonUser + "','sProcessCode' :'" + sprocesscode + "'}",
                dataType: "json",
                success: function (Result) {
                    try {

                       
                        for (var i = 0; i < Result.d.length; i++) {
                            WF_GetLogonAsListing1[i] = { "EmployeeId": Result.d[i].LogonAsUserId, "EmployeeName": Result.d[i].LogonAsUserName};                           
                        }

                       

                    }
                    catch (ex)
                    {
                        alert(ex.message);
                    }

                },
                failure: function (arg1, arg2) {
                    alert("Failure:GetLogonAsListing");
                },
                error: function (Result, Error, arg3, arg4) {
                    alert("Error:GetLogonAsListing: " + Error.toString());
                }
            });             

            /****** ddlDelegate_LogonAs DDL ******/
            $("#ddlDelegate_LogonAs").igCombo({
                mode: "dropdown", 
                dataSource: WF_GetLogonAsListing1,
                valueKey: "EmployeeId",
                textKey: "EmployeeName",
                nullText: "Please Select",
                noMatchFoundText: "No Match Found!",
                multiSelection: false,
                selectionChanged: function (evt, ui) {
                    //alert(ui.items[0].value);
                    document.getElementById("hidLogonAsUser").value = ui.items[0].value;
                    //alert($("#ddlClaimType").igCombo("values"));
                }
            });


});

 

Regards,
Say Chao

  • 20255
    Offline posted

    Hello,

    Thank you for contacting us.

    About the issue, could you please let me know are you sure that ajax request returns data (Result.d is not empty)? I've performed the same JSON implementation with for loop and assigned it to a igCombo and everything worked as expected.

    Could you please check what is the returned result and do the WF_GetLogonAsListing1 array have any data.

    Your code seems fine and should work, yes.

    Looking forward to hearing from you.