jQWidgets Forums

jQuery UI Widgets Forums Grid Grid with dropdown column and show value

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Yavor Dashev 3 years, 7 months ago.

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

  • jespernielsen
    Participant

    Hi,

    Is it possible to have a grid with a dropdown column with countries that shows the selected country code in the grid and the countries names in the dropdown? If yes, how? Tried to search for it in the documentation but not easy to find…

    Thanks
    /Jesper


    Yavor Dashev
    Participant

    Hi jespernielsen,

    You can use the valueMemeber property of the jqxDropdownList and I have created a quick code snippet that can showcase how to set it:

      {
                            text: 'Ship City', datafield: 'ShipCity', width: 150, columntype: 'dropdownlist',
                            createeditor: function (row, column, editor) {
                                var source =
                                    {
                                        datatype: "jsonp",
                                        datafields: [
                                            { name: 'countryName' },
                                            { name: 'name' },
                                            { name: 'population', type: 'float' },
                                            { name: 'continentCode' }
                                        ],
                                        url: "http://api.geonames.org/searchJSON",
                                        data: {
                                            featureClass: "P",
                                            style: "full",
                                            maxRows: 50,
                                            username: "jqwidgets"
                                        }
                                    };
                                    var dataAdapter = new $.jqx.dataAdapter(source);
                                    editor.jqxDropDownList(
                                        {
                                        
                                            source: dataAdapter, 
                                            selectedIndex: 0,
                                            displayMember: "continentCode",
                                        });
                            },
                        },

    Let me know if that works for you!

    Please, do not hesitate to contact us if you have any additional questions.

    Best Regards,
    Yavor Dashev
    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.