如何在Nestable插件中刷新(重建)树?

时间:2018-01-19 10:11:39

标签: javascript jquery jquery-nestable

我使用Nestable2插件在我的项目中创建树。

我需要在ajax更新树时刷新(重建)树。我使用下一个代码。它正确地创建树,但我无法改变(移动)深度(水平)。如何解决这个问题?

$('.dd').nestable('init').nestable({maxDepth: 6}).nestable('collapseAll');

2 个答案:

答案 0 :(得分:0)

此代码适用于我:

$('.dd').nestable('destroy');
$('.dd').nestable({maxDepth: 6}).nestable('collapseAll');

答案 1 :(得分:0)

此代码对我有用:

Traceback (most recent call last): File "main.py", line 164, in <module> model = get_siamese_model((105, 105, 1)) File "main.py", line 129, in get_siamese_model kernel_initializer=initialize_weights, kernel_regularizer=l2(2e-4))) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 456, in _method_wrapper result = method(self, *args, **kwargs) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 198, in add layer(x) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 897, in __call__ self._maybe_build(inputs) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2416, in _maybe_build self.build(input_shapes) # pylint:disable=not-callable File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/layers/convolutional.py", line 163, in build dtype=self.dtype) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 577, in add_weight caching_device=caching_device) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 743, in _add_variable_with_custom_getter **kwargs_for_getter) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer_utils.py", line 141, in make_variable shape=variable_shape if variable_shape else None) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 259, in __call__ return cls._variable_v1_call(*args, **kwargs) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 220, in _variable_v1_call shape=shape) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 198, in <lambda> previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2598, in default_variable_creator shape=shape) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 263, in __call__ return super(VariableMetaclass, cls).__call__(*args, **kwargs) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1434, in __init__ distribute_strategy=distribute_strategy) File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1567, in _init_from_args initial_value() if init_from_fn else initial_value, File "/home/fabio/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer_utils.py", line 121, in <lambda> init_val = lambda: initializer(shape, dtype=dtype) TypeError: initialize_weights() got an unexpected keyword argument 'dtype' 文件中进行以下更改:

查找此内容:

jquery.nestable.js

替换为:

item = $.extend({}, li.data()),