File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ <h1>Two grids demo</h1>
103
103
float : false ,
104
104
removable : '.trash' ,
105
105
removeTimeout : 100 ,
106
- acceptWidgets : '.grid-stack-item'
106
+ acceptWidgets : function ( i , el ) { return true ; } // function example, else can be simple: true | false | '.someClass' value
107
107
} ;
108
108
$ ( '#grid1' ) . gridstack ( options ) ;
109
109
$ ( '#grid2' ) . gridstack ( $ . extend ( { } , options , {
Original file line number Diff line number Diff line change @@ -62,8 +62,10 @@ gridstack.js API
62
62
63
63
## Options
64
64
65
- - ` acceptWidgets ` - if ` true ` of jquery selector the grid will accept widgets dragged from other grids or from
66
- outside (default: ` false ` ) See [ example] ( http://gridstackjs.com/demo/two.html )
65
+ - ` acceptWidgets ` - accept widgets dragged from other grids or from outside (default: ` false ` ). Can be:
66
+ * ` true ` (uses ` '.grid-stack-item' ` class filter) or ` false `
67
+ * string for explicit class name
68
+ * function (i: number, element: Element) returning a boolean. See [ example] ( http://gridstack.github.io/gridstack.js/demo/two.html )
67
69
- ` alwaysShowResizeHandle ` - if ` true ` the resizing handles are shown even if the user is not hovering over the widget
68
70
(default: ` false ` )
69
71
- ` animate ` - turns animation on (default: ` false ` )
Original file line number Diff line number Diff line change @@ -398,10 +398,12 @@ declare namespace GridStackUI {
398
398
*/
399
399
interface GridstackOptions {
400
400
/**
401
- * if true of jquery selector the grid will accept widgets dragged from other grids or from
402
- * outside (default: false) See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
401
+ * accept widgets dragged from other grids or from outside (default: `false`). Can be:
402
+ * `true` (uses `'.grid-stack-item'` class filter) or `false`,
403
+ * string for explicit class name,
404
+ * function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
403
405
*/
404
- acceptWidgets ? : boolean | string | ( ( i : number , element : Element ) => boolean | string ) ;
406
+ acceptWidgets ? : boolean | string | ( ( i : number , element : Element ) => boolean ) ;
405
407
406
408
/**
407
409
* if true the resizing handles are shown even if the user is not hovering over the widget (default?: false)
You can’t perform that action at this time.
0 commit comments