|
90 | 90 | node.width = parseInt('' + node.width);
|
91 | 91 | node.height = parseInt('' + node.height);
|
92 | 92 | node.auto_position = node.auto_position || false;
|
| 93 | + node.no_resize = node.no_resize || false; |
| 94 | + node.no_move = node.no_move || false; |
93 | 95 |
|
94 | 96 | if (node.width > this.width) {
|
95 | 97 | node.width = this.width;
|
|
278 | 280 | one_column_mode = true;
|
279 | 281 |
|
280 | 282 | _.each(self.grid.nodes, function (node) {
|
281 |
| - node.el.draggable('disable'); |
282 |
| - if (!node.el.attr('data-gs-no-resize')) { |
| 283 | + if (!node.no_move) { |
| 284 | + node.el.draggable('disable'); |
| 285 | + } |
| 286 | + if (!node.no_resize) { |
283 | 287 | node.el.resizable('disable');
|
284 | 288 | }
|
285 | 289 | });
|
|
291 | 295 | one_column_mode = false;
|
292 | 296 |
|
293 | 297 | _.each(self.grid.nodes, function (node) {
|
294 |
| - node.el.draggable('enable'); |
295 |
| - if (!node.el.attr('data-gs-no-resize')) { |
| 298 | + if (!node.no_move) { |
| 299 | + node.el.draggable('enable'); |
| 300 | + } |
| 301 | + if (!node.no_resize) { |
296 | 302 | node.el.resizable('enable');
|
297 | 303 | }
|
298 | 304 | });
|
|
325 | 331 | max_height: el.attr('data-gs-max-height'),
|
326 | 332 | min_height: el.attr('data-gs-min-height'),
|
327 | 333 | auto_position: el.attr('data-gs-auto-position'),
|
| 334 | + no_resize: el.attr('data-gs-no-resize'), |
| 335 | + no_move: el.attr('data-gs-no-move'), |
328 | 336 | el: el
|
329 | 337 | });
|
330 | 338 | el.data('_gridstack_node', node);
|
|
367 | 375 | });
|
368 | 376 | };
|
369 | 377 |
|
370 |
| - el.draggable({ |
371 |
| - handle: this.opts.handle, |
372 |
| - scroll: true, |
373 |
| - appendTo: 'body', |
374 |
| - |
375 |
| - start: on_start_moving, |
376 |
| - stop: on_end_moving, |
377 |
| - drag: function (event, ui) { |
378 |
| - var x = Math.round(ui.position.left / cell_width), |
379 |
| - y = Math.floor(ui.position.top / cell_height); |
380 |
| - self.grid.move_node(node, x, y); |
381 |
| - self._update_container_height(); |
382 |
| - } |
383 |
| - }); |
| 378 | + if (!node.no_move) { |
| 379 | + el.draggable({ |
| 380 | + handle: this.opts.handle, |
| 381 | + scroll: true, |
| 382 | + appendTo: 'body', |
| 383 | + |
| 384 | + start: on_start_moving, |
| 385 | + stop: on_end_moving, |
| 386 | + drag: function (event, ui) { |
| 387 | + var x = Math.round(ui.position.left / cell_width), |
| 388 | + y = Math.floor(ui.position.top / cell_height); |
| 389 | + self.grid.move_node(node, x, y); |
| 390 | + self._update_container_height(); |
| 391 | + } |
| 392 | + }); |
384 | 393 |
|
385 |
| - if (this._is_one_column_mode()) { |
386 |
| - el.draggable('disable'); |
| 394 | + if (this._is_one_column_mode()) { |
| 395 | + el.draggable('disable'); |
| 396 | + } |
387 | 397 | }
|
388 | 398 |
|
389 |
| - if (!el.attr('data-gs-no-resize')) { |
| 399 | + if (!node.no_resize) { |
390 | 400 | el.resizable({
|
391 | 401 | autoHide: true,
|
392 | 402 | handles: 'se',
|
|
0 commit comments