【问题标题】:Trying to get Gridster to call functions like disable but $('.gridster ul').gridster().data('gridster'); not working试图让 Gridster 调用诸如 disable 但 $('.gridster ul').gridster().data('gridster'); 之类的函数不工作
【发布时间】:2015-08-10 19:54:04
【问题描述】:

我正在使用 angular gridster,我希望能够执行诸如删除项目或暂时禁用它之类的操作。

How to remove a single widget from gridster.js by his dynamically created id HighStocks draggable element interfering with gridster dragging

但是,当我尝试使用 $('.gridster ul').gridster().data('gridster'); 行时,出现错误 TypeError: $(...).gridster is not a功能

【问题讨论】:

  • 您使用什么代码:问题的代码或答案之一?
  • 请确保您加载了所有必需的文件,因为错误可能是由于加载模块不正确造成的。
  • Mathias,我尝试了不同的 $('.gridster ul').gridster().data('gridster') ... $('.gridster ul') 变体对象,但我不能调用它。

标签: angularjs highcharts gridster


【解决方案1】:

首先,您必须初始化gridster。为此,您可以使用以下代码

$(".gridster ul").gridster({
       widget_margins: [10, 10],
       widget_base_dimensions: [140, 140]
 });

基本尺寸是单个图块的宽度和高度(以像素为单位)

那你就可以打电话了

var gridster = $("#demo-2 ul").gridster().data('gridster'); //object of gridster

【讨论】:

    猜你喜欢
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多