【问题标题】:Gridster resize stop idGridster 调整停止 id
【发布时间】:2014-06-05 18:26:09
【问题描述】:

我有一个 gridster 网格正在工作,我正在尝试获取已调整大小的 <li> 项目的 ID。

resize: { enabled: true, stop: function (e, ui, $widget) {
//Need the id of the item that was just resized } }

【问题讨论】:

    标签: jquery gridster


    【解决方案1】:

    您是否考虑过:

    $widget.attr('id');

    【讨论】:

    • 知道如何获取它的 id 以用于拖动(而不是调整大小)上的停止事件吗?那个函数没有通过你看到的 $widget。
    • 好吧,我想通了。您可以像这样从 ui 对象中获取它:ui.$player.attr('id');
    【解决方案2】:

    我意识到我的问题在于我在 gridster 中序列化了参数:

    serialize_params: function ($w, wgd) { return { DataTypeId: wgd.el[0].id, Column: wgd.col, Row: wgd.row, SizeX: wgd.size_x, SizeY: wgd.size_y } },

    所以在我的“停止”事件中我可以使用:

    var newDimensions = this.serialize($widget)[0] newDimensions.DataTypeId

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-10
      • 1970-01-01
      • 1970-01-01
      • 2013-05-15
      • 1970-01-01
      • 2018-01-10
      • 2017-05-14
      相关资源
      最近更新 更多