jqGrid inline edit: odd behavior with an autocomplete column

前端 未结 1 1196
鱼传尺愫
鱼传尺愫 2021-01-07 14:34

I have a jqGrid (using inline editing) with an autocomplete column. When the user selects a value from the autocomplete column, an event handler sets a value on another col

相关标签:
1条回答
  • 2021-01-07 15:20

    You should rename Name property of the items from the autocompleteSource to value because jQuery UI Autocomplete examines the label and value per default (see the documentation).

    You can't use setCell of the 'cartoon' column which is currently in the editing mode. You should remove return false; from select callback too. So the code could looks about the following

    dataInit: function (elem) {
        $(elem).autocomplete({
            source: autocompleteSource,
            select: function (event, ui) {
                var rowId = $("#inlineGrid").jqGrid('getGridParam', 'selrow');
                if (ui.item) {
                    $("#inlineGrid").jqGrid('setCell', rowId, 'cartoonId',
                        ui.item.CartoonId);
                }
            }
        });
    }
    

    See http://jsfiddle.net/27dLM/38/

    0 讨论(0)
提交回复
热议问题