0

特定のデータを表示するために slickgrid を使用しています。カスタムメソッドを slickgrid 行に追加するにはどうすればよいですか?

例: Enter キーが押されるたびに、現在の行データでモーダル ボックスを開きたい。

4

2 に答える 2

5

onKeyDownグリッドでイベントをサブスクライブして、これを確認できます。何かのようなもの:

grid.onKeyDown.subscribe(function(e) {
   if (e.which == 13) {
      // open modal window
   }
});

これが役立つかどうか教えてください!

于 2012-11-02T17:00:59.313 に答える
0

私があなたの要求をよく理解したら、このコードを試してください。

createInvoiceDetailsTable : function () {
    var gridOptions, gridColumns;

    gridColumns = [
        {id:'ean_code', name:'EAN', field:'ean_code', width:125, cssClass: 'grid-cell'},
        {id:'description', name:'Product Description', field:'description', width:250, formatter:opr.invoice.productGridDescriptionFormatter, cssClass: 'grid-cell'},
        {id:'qty', name:'Qty', field:'qty', width:40, , formatter:UpdateQtyBtnFormatter},
    ];



    gridOptions = {
        editable: true,
        autoEdit: true,
        enableAddRow: false,
        enableCellNavigation: true,
        asyncEditorLoading: false,
        enableColumnReorder: false,
        rowHeight: 35
    };

    dataView = new Slick.Data.DataView();
    invoiceProductGrid = new Slick.Grid($('#invoice_details_grid_div'), dataView , gridColumns, gridOptions);

    function UpdateQtyBtnFormatter (row, cell, value, columnDef, dataContext) {
        return '<input type="button" style="width:30px; height:30px;" class="update_invoice_product_qty" id="' + value + '" value="Q"/>';
}
}

このupdate_invoice_product_qtyクラス名を使用して、イベントを記述できます。

これが必要でない場合は、以前に試したコードまたは手順を共有してください。

于 2012-11-02T09:36:30.187 に答える