jQWidgets Forums

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • jineshsvccam
    Participant

    Hi,

    I am using two functions to bind dropdownlist and textbox. My problem is both combobox and textbox not working together.
    that is if i use ‘loadcombo_Head’ function to bind the combobox the other function ‘loadcombo_Name’ not loading the autocomplete name.
    but if i use ‘loadcombo_Name’ as a first call then it will work on the same time ‘loadcombo_Head’ will not work.
    Hope you understand my problem.
    any suggestions to my problem

     <script type="text/javascript" language="javascript">
            $(document).ready(function () {
                $(this).loadcombo_Head();
                $(this).loadcombo_Name();
            });
        </script>
    
    
      $.fn.loadcombo_Head = function () {
            var obj = {};
            obj.ParishName = "St.George Malankara Catholic Church";
            obj.qtype = "Head";
            source = {
                datatype: "json",
                datafields: [
                                    { name: 'HEID' },
                                    { name: 'HeadName' }
                                ]
            };
            $.ajax({
                type: "POST",
                url: "DataWebService.asmx/loadcombo",
                data: JSON.stringify(obj),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    source.localdata = data.d;
                    var dataAdapter_Head = new $.jqx.dataAdapter(source);
                    $("#dllist").jqxDropDownList({
                        selectedIndex: 0,
                        source: dataAdapter_Head,
                        displayMember: "HeadName",
                        valueMember: "HEID",
                        width: 250,
                        height: 25
                    });
                    // $("#jqxDropDownList").jqxDropDownList('setContent', 'Masavari');
                    // $("#jqxDropDownList").jqxDropDownList('val', "Masavari");                   
                },
                error: function (error) {
                    alert("Error");
                }
            });
        }
    
    $.fn.loadcombo_Name = function () {
        var obj = {};
        obj.ParishName = "St.George Malankara Catholic Church";
        obj.qtype = "Name";
        source = {
            datatype: "json",
            datafields: [
                                    { name: 'FullName' },
                                    { name: 'UnitName' }
                                ]
        };
        $.ajax({
            type: "POST",
            url: "DataWebService.asmx/loadcombo",
            data: JSON.stringify(obj),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
               // alert(JSON.stringify(data));
                source.localdata = data.d;
                var dataAdapter_Name = new $.jqx.dataAdapter(source);
               // jqxInput
                $("#jqxInput").jqxInput({
                    source: dataAdapter_Name,
                    displayMember: "FullName",
                    valueMember: "UnitName",
                    minLength: 1,
                    width: 200,
                    height: 25
                });
            },
            error: function (error) {
                alert("Error");
            }
        });
    }

    Peter Stoev
    Keymaster

    Hi jineshsvccam,

    You create each widget within Ajax success function. It would be really lucky coincidence if two different Ajax calls finish at the same time. That is why it is called AJAX – A stands for Asynchronous. Our widgets work perfectly well together. If there is an issue, it is not on our side so I would suggest you to debug your client and server code for issues. If you wish, you can look at a demo with ComboBoxes and Inputs: http://www.jqwidgets.com/jquery-widgets-demo/demos/php/billing_form.htm?arctic. You also missed in your code the “var” before “source”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.