Dynatree - 如何转换来自服务器的 json?

发布于 2024-12-27 05:41:54 字数 759 浏览 5 评论 0原文

我正在寻找有关 dynatree 插件的帮助。

我需要转换来自服务器的 json 以使其成为动态树 兼容(我不允许在服务器端执行此操作),

下面的这显然不起作用:

                    initAjax: { 
                            url: '/admin/tenant/jsontree', 
                            data: { 
                                    tenantId: 1 
                            }, 
                            success: function(data) { 
                                    // do modifications to the data returned from server 
                                   // and return formatted data 
                            } 
                    } 

而且我在文档中找不到它的回调。 所以我的问题是:是否可以用一些东西来进行初始转换 回调还是我应该寻找其他一些插件?

先感谢您

I'm looking for some help with dynatree plugin.

I need to transform the json coming from the server to make it dynatree
compatible (I'm not allowed to do it on the server side),

This below apparently doesn't work:

                    initAjax: { 
                            url: '/admin/tenant/jsontree', 
                            data: { 
                                    tenantId: 1 
                            }, 
                            success: function(data) { 
                                    // do modifications to the data returned from server 
                                   // and return formatted data 
                            } 
                    } 

And I couldn't find a callback for it in the documentation.
So my question is: is it possible to do that initial transformation with some
callbacks or should I be looking for some other plugins?

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囍笑 2025-01-03 05:41:54

查看文档中的“加载自定义格式”:

http://wwwendt.de/tech/dynatree/doc/dynatree-doc.html

基本上,您可以将标准 $.ajax() 选项传递给 initAjax(),例如 dataFilter
(还有一个尚未记录的 postProcess 回调选项。)

Have a look at 'Loading custom formats' in the docs:

http://wwwendt.de/tech/dynatree/doc/dynatree-doc.html

basically you can pass the standard $.ajax() options to initAjax(), such as dataFilter.
(There is also a - yet undocumented - postProcess callback option.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文