Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/two.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h1>Two grids demo</h1>
float: false,
removable: '.trash',
removeTimeout: 100,
acceptWidgets: '.grid-stack-item'
acceptWidgets: function(i, el) { return true; } // function example, else can be simple: true | false | '.someClass' value
};
$('#grid1').gridstack(options);
$('#grid2').gridstack($.extend({}, options, {
Expand Down
6 changes: 4 additions & 2 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ gridstack.js API

## Options

- `acceptWidgets` - if `true` of jquery selector the grid will accept widgets dragged from other grids or from
outside (default: `false`) See [example](http://gridstackjs.com/demo/two.html)
- `acceptWidgets` - accept widgets dragged from other grids or from outside (default: `false`). Can be:
* `true` (uses `'.grid-stack-item'` class filter) or `false`
* string for explicit class name
* function (i: number, element: Element) returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
- `alwaysShowResizeHandle` - if `true` the resizing handles are shown even if the user is not hovering over the widget
(default: `false`)
- `animate` - turns animation on (default: `false`)
Expand Down
8 changes: 5 additions & 3 deletions src/gridstack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,12 @@ declare namespace GridStackUI {
*/
interface GridstackOptions {
/**
* if true of jquery selector the grid will accept widgets dragged from other grids or from
* outside (default: false) See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
* accept widgets dragged from other grids or from outside (default: `false`). Can be:
* `true` (uses `'.grid-stack-item'` class filter) or `false`,
* string for explicit class name,
* function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
*/
acceptWidgets ? : boolean | string | ((i: number, element: Element) => boolean | string);
acceptWidgets ? : boolean | string | ((i: number, element: Element) => boolean);

/**
* if true the resizing handles are shown even if the user is not hovering over the widget (default?: false)
Expand Down