场景

Jstree的树形结构正好好运行,给数据添加了禁用状态后,就提示:

JsTree中提示:Cannot read property 'core' of underfinedJsTree中提示:Cannot read property 'core' of underfined

在仔细比对代码没错订单情况下,猜测是数据原因。

实现

因为添加了是否禁用状态,首次进入页面时默认加载启用的数据,但是启用的数据中可能会有pid(即父节点i)被禁用的场景。

就会出现如下这种:

查询返回的数据中pid属性在id中不存在。

JsTree中提示:Cannot read property 'core' of underfinedJsTree中提示:Cannot read property 'core' of underfined

解决:

将数据库中禁用的数据先启用,首次访问时默认查询全部数据。最终使pid的属性值都存在。

相关文章:

  • 2021-08-16
  • 2021-09-11
  • 2021-11-22
  • 2021-07-09
  • 2021-12-02
  • 2022-01-06
  • 2021-08-12
  • 2021-12-24
猜你喜欢
  • 2021-10-07
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-09-30
  • 2021-08-11
  • 2021-07-17
相关资源
相似解决方案