2

jqwidgets の Jqxgrid を使用しています。

グリッドでドロップダウン リストを取得しました。

ページの読み込み時にデフォルトで編集可能モードでドロップダウン リストを表示したい。

最初のドロップダウンが「選択してください」と表示されているこのスクリーンショットを見てください。グリッドセルをクリックすると、デフォルトをバインドする方法が表示されます。

ここに画像の説明を入力

以下はコードです。

{
                text: 'Position of meter in Rack', datafield: 'MeterPositionInRack', width: 180, columntype: 'dropdownlist', editable: true,
                createeditor: function (row, column, editor) {
                    var list = ['1', '2', '3' ,'4'];
                    editor.jqxDropDownList({ autoDropDownHeight: true, source: list, selectedIndex: 0 });

                    editor.jqxDropDownList.bind('select', function (event) {
                        var args = event.args;
                        var item = $('#jqxdropdownlist').jqxDropDownList('getItem', args.index);
                        alert('Selected: ' + item.label);
                    });
                }
                , initeditor: function (row, cellvalue, editor) {
                    var list1 = ['1', '2', '3', '4'];
                    console.log("initeditor: " + list1);
                    editor.jqxDropDownList({ autoDropDownHeight: true, source: list1, selectedIndex: 0 });
                }
            }

私を助けてください。

4

1 に答える 1

2

Jqxgrid にはready、グリッドが初期化されてバインディングが完了した後に何かを行うためのプロパティがあるため、begin update メソッドをトリガーできます。

$("#jqxgrid").jqxGrid({
 ...
 ready: function () {
          $("#jqxgrid").jqxGrid('beginrowedit', 0);
      },
 ...
 });

も参照してください

于 2015-04-22T01:00:44.307 に答える