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>
103103 float : false ,
104104 removable : '.trash' ,
105105 removeTimeout : 100 ,
106- acceptWidgets : '.grid-stack-item'
106+ acceptWidgets : function ( i , el ) { return true ; } // function example, else can be simple: true | false | '.someClass' value
107107 } ;
108108 $ ( '#grid1' ) . gridstack ( options ) ;
109109 $ ( '#grid2' ) . gridstack ( $ . extend ( { } , options , {
Original file line number Diff line number Diff line change @@ -62,8 +62,10 @@ gridstack.js API
6262
6363## Options
6464
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 )
6769- ` alwaysShowResizeHandle ` - if ` true ` the resizing handles are shown even if the user is not hovering over the widget
6870 (default: ` false ` )
6971- ` animate ` - turns animation on (default: ` false ` )
Original file line number Diff line number Diff line change @@ -398,10 +398,12 @@ declare namespace GridStackUI {
398398 */
399399interface GridstackOptions {
400400 /**
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)
403405 */
404- acceptWidgets ? : boolean | string | ( ( i : number , element : Element ) => boolean | string ) ;
406+ acceptWidgets ? : boolean | string | ( ( i : number , element : Element ) => boolean ) ;
405407
406408 /**
407409 * 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