jQuery UI Widgets Forums Plugins Data Adapter DataAdaptor Records Empty

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • DataAdaptor Records Empty #97820

    nja
    Participant

    Hi,
    I would like to access the records in my dataadpater. The adapter is using json and I am binding the adaptor.

    However, <adaptor>.records; returns an empty array.

    Though the adaptor populates the Combobox widget properly right after.

    The final goal is to be able to set the selectedIndex based on the PublisherId number set separately, so I need to verify the id exists in the dataapater and what position it is in before moving on to the next step of the page.

    Thanks,
    nja

    
                var publisherSource =
                        {
                            datatype: "json",
                            datafields: [
                                { name: 'PublisherLongName' },
                                { name: 'PublisherId' }
                            ],
                            url: '/Publications/PublisherDDL/'
                        };          
                
                var publisherAdapter = new $.jqx.dataAdapter(publisherSource);
    
                publisherAdapter.dataBind();
                var recordi = publisherAdapter.records;
                console.log(recordi);
    
    // recordi is always empty!
    
    // but ComboBox is working fine
    
                $("#publisher").jqxComboBox(
                {
                    source: publisherAdapter,
                    width: 280,
                    height: 25,
                    autoItemsHeight: true,
                    autoDropDownHeight: true,
                    promptText: "Select publisher...",
                    displayMember: 'PublisherLongName',
                    valueMember: 'PublisherId',
                    theme: theme,
                    searchMode: 'contains',
                    selectedIndex: 0 // testing select
                });
    DataAdaptor Records Empty #97823

    Peter Stoev
    Keymaster

    Hi nja,

    You are binding through AJAX which means it is asynchronous process. When the process is completed, then you can access the records.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.