jsTree 的数据源是什么?
我想使用 jsTree 编写一个应用程序,它可以显示和操作我的硬盘的目录结构(一个选定的目录和所有子目录)。操作=读取/更新/创建文件&创建新目录。
我对 jsTree 没有真正的经验,我想知道
- 我应该使用什么数据源(html、json、xml)类型以及
- 为什么
- 欢迎使用其他建议而不是 jsTree
(所有都在 sinatra + haml 上运行)在窗户上)
I want to write an application using jsTree that would display and manipulate directory structure of my hdd (one selected directory and all subdirectories). Manipulate = read/update/create files & create new directories.
I have no real experience with jsTree and I wonder
- what data source (html, json, xml) type I should use and
- why
- other suggestions what to use instead of jsTree are welcome
(all runs on sinatra + haml on windows)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将是一个有点逃避的答案,但您确实应该使用最适合您的项目的数据源。 jsTree 可以处理所有这三种情况,但是,出于某种原因,选择其中一种可能会对您有利。
在我自己使用 jsTree 的过程中,我发现使用 JSON 是最简单的,因为它非常容易构建和创建服务器端(我使用的是 ASP.NET MVC)。它只需要很少的工作就可以完成,并且我可以在一个类中包含树的构建。
除了 jsTree (基于您正在使用的技术)之外,我没有任何其他具体建议。我会说做出决定并尝试一下。如果您使用源代码管理,如果事情不适合您,您可以随时回滚。然而,听起来您最好真正开始使用 jsTree 并看看它是否适合您的需求。它不是一个非常“重”的库,因此很容易开始让它工作并看看您是否喜欢它。
然而,一条建议是保留文档和论坛供您使用,因为有些功能在官方文档中没有完全更新,但在论坛中有所介绍。 (我以这种方式遇到了一个特定问题,通过在论坛中进行一些搜索解决了该问题。)
This is going to be a bit of a cop-out answer, but you really should use the data source that best fits your project. jsTree can handle all three, but, for one reason or another, it may benefit you to choose one in particular.
In my own use of jsTree, I have found it easiest to use JSON because it is very easy to build and create server-side (where I am using ASP.NET MVC). It requires very little work to accomplish, and I can encompass the building of the tree in a single class.
I don't have any other particular suggestions other than jsTree (based on the technology you are using). I would say make a decision and give it a try. If you're using source control, you can always roll back if things don't work out for you. However, it sounds like you would do best to actually start using jsTree and seeing if it fits your needs. It's not a very "heavy" library, so it is fairly easy to begin getting it to work and see how you like it.
One piece of advice, however, is keep both the documentation AND the forums available to you as there are some features that are not fully updated in the official documentation, but it is covered in the forums. (I ran into one particular issue in this manner which was solved through some searching in the forums.)