jQWidgets Forums

jQuery UI Widgets Forums Grid Bug when using ComboBox as editor in Grid?

Tagged: 

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

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

  • dradon
    Member

    I’ve run across what looks like a bug when using a combobox as the editor in a grid.  Namely, if I use autoComplete on the combobox to filter the list and attempt to select items, the wrong items are selected.

    This seems to be because the selected index being reported by the combobox is the index into the filtered list of items, but the grid turns around and uses it to get the item from the full list of items, so the indexes don’t line up.  I tried tweaking it to grab the visible item from the combobox’s listbox instead, and that fixes it for mouse-picking, but picking via the keyboard is still busted if you pick anything except the first item in the filtered list (because the visible items collapse down to a single item once you’ve selected one and hit Enter).

    Here is some simple code that should reproduce the problem.  Notice that picking from the unfiltered list works great, but once you type something into the combobox and the list is filtered, picking stops working correctly.

    <html><head><title>Grid ComboBox Test</title>
    <!-- I've omitted the required css & js for brevity - add them back for testing -->
    <script type="text/javascript">
    var colors = [{color : 'Red'}, {color : 'Orange'}, {color : 'Yellow'}, {color : 'Green'}, {color : 'Blue'}, {color : 'Indigo'}, {color : 'Violet'}];
    var gridData = [ {color : 'Orange'}, {color : 'Blue'}];
    $(function () {
    var gridDS = {
    datatype : 'array',
    localdata : gridData,
    datafields : [
    { name : 'color' }
    ]
    };
    var gridDA = new $.jqx.dataAdapter(gridDS, { });
    var colorsDS = {
    datatype : 'array',
    localdata : colors,
    datafields : [
    { name : 'color' }
    ]
    };
    var colorsDA = new $.jqx.dataAdapter(colorsDS, { });
    $('#dataGrid').jqxGrid({
    width : 600,
    source : gridDA,
    columns : [
    { text : 'Color',
    datafield : 'color',
    columntype : 'combobox',
    createeditor : function (row, column, editor) {
    editor.jqxComboBox({
    source : colorsDA,
    autoComplete : true,
    searchMode : 'containsignorecase',
    displayMember : 'color',
    valueMember : 'color'
    });
    },
    }
    ],
    editable : true,
    selectionmode : 'singlecell'
    });
    });
    </script>
    </head>
    <body>
    <div id="dataGrid"></div>
    </body>
    </html>

    Peter Stoev
    Keymaster

    Hi dradon,

    ComboBox editor is not currently expected to be in auto-complete mode in jqxGrid. The feature is disabled by default when the editor is embedded in jqxGrid. We will do our best to add support for it in a future version.

    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.