jQWidgets Forums

jQuery UI Widgets Forums Grid Dropdown Grid to SQL

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Dropdown Grid to SQL #5117

    amwebb
    Member

    It seems my original issue with placing more than one dropdown grid on a page is in part due to the fact that I may not be binding the dropdown to SQL properly. Is this how it should be done? I’m getting this error in Firebug “row is null” on var dropDownContent. I understand that it is null because I’m not using generatedata as my source. I’m instead calling the info from SQL. Just not sure what to put instead of row.

    $(document).ready(function () {
    var theme = getTheme();
    var createGrid = function (gridid, dropdownid) {

    var source =
    {

    datatype: “json”,
    datafields: [{ name: ‘Description’ }, ],
    url: ‘Map/GetRegion’,
    updaterow: function (rowid, rowdata) {
    // synchronize with the server – send update command
    }
    };

    // initialize jqxGrid
    $(dropdownid).jqxDropDownButton({ width: 150, height: 25, theme: theme });
    $(gridid).jqxGrid(
    {
    width: 550,
    source: source,
    theme: theme,
    pageable: true,
    autoheight: true,
    columns: [
    { text: ‘Description’, columntype: ‘textbox’, datafield: ‘Description’, width: 90 },

    ]
    });
    $(gridid).bind(‘rowselect’, function (event) {
    var args = event.args;
    var row = $(gridid).jqxGrid(‘getrowdata’, args.rowindex);
    var dropDownContent = ‘

    ‘ + row[‘Description’] + ‘

    ‘;
    $(dropdownid).jqxDropDownButton(‘setContent’, dropDownContent);
    });
    $(gridid).jqxGrid(‘selectrow’, 0);
    }
    createGrid(“#jqxgrid”, “#jqxdropdownbutton”);

    });

    Dropdown Grid to SQL #5188

    Peter Stoev
    Keymaster

    Hi amwebb,

    There are currently 2 small issues in the posted code:

    – In the source’s datafields definition. You have only 1 item and you should delete the last ‘,’.

    datafields: [{ name: 'Description' }]

    – In the columns definition.

    { text: 'Description', columntype: 'textbox', datafield: 'Description', width: 90 },

    should be:

    { text: 'Description', columntype: 'textbox', datafield: 'Description', width: 90 }

    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.