mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-25 16:11:24 +08:00
The current situation force the user to have a not necessary creation of an HtmlElement object. In fact, you do not need. JQuery Gridster has a plugin that take a single parameter which is the option. This is why that Pull Request fix this issue but also the issue that when debugging the unit test you can see that the injected options were the HtmlElement instead of the real options.
23 lines
541 B
TypeScript
23 lines
541 B
TypeScript
/// <reference path="gridster.d.ts" />
|
|
|
|
interface SerializeData {
|
|
x?: number;
|
|
y?: number;
|
|
}
|
|
|
|
var options: GridsterOptions = {
|
|
min_cols: 5,
|
|
autogenerate_sytesheet: true,
|
|
serialize_params: ($w: JQuery, wgd: GridsterCoords) => {
|
|
return {
|
|
x: wgd.row,
|
|
y: wgd.col
|
|
};
|
|
}
|
|
};
|
|
|
|
var gridster = <Gridster>$('.gridster ul').gridster(options).data('grister');
|
|
gridster.add_widget('<li class="new">The HTML of the widget...</li>', 2, 1);
|
|
gridster.remove_widget($('gridster li').eq(3).get(0));
|
|
var json = gridster.serialize<SerializeData>();
|