jQWidgets Forums

jQuery UI Widgets Forums Plugins Data Adapter Multiple duplicate requests sent to server

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

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

  • amul.sapkota
    Participant

    Multiple Duplicate Request is sent while populating the combobox.

    Source Code:

    var ownerSource =
    {
        datatype: "json",
        datafields: [
            { name: 'id', type: 'number' },
            { name: 'first_name', type: 'string' },
            { name: 'last_name', type: 'string' }
        ],
        url: '{{ action("users.ownerjson") }}',
        cache: false,
        root: 'records',
        id : 'id'
    },
    
    ownerAdapter = new $.jqx.dataAdapter(ownerSource, {
        autoBind: true,
        beforeLoadComplete: function (records) {
            var data = new Array();
            for (var i = 0; i < records.length; i++) {
                var owner = records[i];
                owner.full_name = owner.first_name + " " + owner.last_name;
                data.push(owner);
            }
            return data;
        },
        loadComplete: function() {
            $("#owner").jqxComboBox('val', '{{ $contact->contact_owner }}');
        }
    });
    
    $("#owner").jqxComboBox({ source: ownerAdapter, valueMember: 'id', displayMember: 'full_name' });

    Screenshot of the Chrome Network Console:

    screenshot of multiple request


    Peter Stoev
    Keymaster

    Hi amul.sapkota,

    The problem is autoBind: true. By doing that the ComboBox makes a request and the dataAdapter makes one automatic.

    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.