fixed how the GridStack object is obtained

jQuery plugins return the jQuery object, to get the plugin, also in the case of GridStack 0.2.6 (latest) you use the data() method with the correct name
This commit is contained in:
Ricky Blankenaufulland
2017-03-09 14:58:30 +01:00
parent ebbfed49ab
commit d4864b74ed
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -10,7 +10,11 @@
var options = <IGridstackOptions> {
float: true
};
var gridstack:GridStack = $(document).gridstack(options);
var element: JQuery = $(document).gridstack(options);
var gridstack: GridStack = $(document).data("gridstack");
var gsFromElement: GridStack = element.data("gridstack");
if (gridstack !== gsFromElement) throw Error('These should match!');
gridstack.addWidget("test", 1, 2, 3, 4, true);
gridstack.batchUpdate();
+2 -1
View File
@@ -4,7 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface JQuery {
gridstack (options: IGridstackOptions):GridStack
gridstack (options: IGridstackOptions): JQuery;
data(key: "gridstack"): GridStack;
}
interface GridStack {