【问题标题】:Displaying a modal in Slick Grid when a cell has focus only the first time it has focus当单元格仅在第一次获得焦点时在 Slick Grid 中显示模式
【发布时间】:2016-08-31 13:02:58
【问题描述】:

当用户将焦点放在一个名为参考号的字段上时,我试图显示一条消息,该字段是我光滑网格上的第 10 列和第 1 行。它也恰好是网格中的最后一个字段。模式应显示一条消息,通知用户他们将要输入的参考号可用于查找其帐户活动。以下是光滑的网格布局。

<script>
var columns = [
            { id: "Country", name: "Country", field: "Country", minWidth: 120,  editor: Slick.Editors.Auto},
    { id: "Manufacturer", name: "Manufacturer", field: "Manufacturer", minWidth: 120, editor: Slick.Editors.Text },
    { id: "ReferenceNumber", name: "Reference Number", field: "ReferenceNumber", minWidth: 120, editor: Slick.Editors.Text },

       ];

这是我想在单击单元格以显示模式时使用的脚本。

<script>
function cellClicked(e) {
    var grid = Columns;
    var cell = grid.getCellFromEvent(e);
    var item = grid.getDataItem(cell.row); // all the data in the row
    if (cell.cell == grid.getColumnIndex('ReferenceNumber')) {

        $('#ReferenceModal').modal('show');
        console.log("ReferenceNumber");
    }
}

如何更改参考编号字段上的编辑器以仅在用户输入单元格(第 10 列,第 1 行)时显示模式?

谢谢

【问题讨论】:

    标签: javascript slickgrid


    【解决方案1】:

    尝试使用grid.onClick.subscribe,例如

    grid.onClick.subscribe(function(e, args) {
        var item = grid.getDataItem(args.row);
        if (args.cell == grid.getColumnIndex('ReferenceNumber')) {
            $('#ReferenceModal').modal('show');
            console.log("ReferenceNumber");
        }
        //.. do more stuff here to flag that the modal was once diplayed. I would imagine modify the item prop e.g. item.displayed=true... then invalidate the items on grid again. 
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-25
      • 1970-01-01
      • 2012-12-05
      • 1970-01-01
      • 2012-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多