jQuery Dashboard 插件 - 如何保存状态更改
我已经开始使用此处演示的仪表板插件 - http://www.gxdeveloperweb。 com/dashboardplugin/demo/dashboard.html
我正在努力处理文档。主要是关于如何保存最终用户更改的仪表板配置。
在文档中,它告诉您如何执行“dashboardStateChange”:
dashboard.element.trigger("dashboardStateChange",{"stateChange":"widgetAdded","widget":widget});
但我真的不明白它在仪表板设置中的位置,以及如何使用它来保存更改。我认为当发生某些事情时我可以从 DOM 中访问仪表板状态更改,但甚至无法理解这是如何完成的。
有没有人有任何关于在仪表板状态发生变化时保存仪表板的提示?我希望它能够与保存仪表板设置的 php 脚本对话。
不幸的是,没有任何关于此类功能的优秀教程。
谢谢!
I've started using the dashboard plugin which is demoed here - http://www.gxdeveloperweb.com/dashboardplugin/demo/dashboard.html
I'm struggling with the documentation. Primarily on how to save dashboard configurations altered by the enduser.
In the documentation, it tells you how to do a "dashboardStateChange":
dashboard.element.trigger("dashboardStateChange",{"stateChange":"widgetAdded","widget":widget});
But I don't really understand where this is to go within the dashboard setup, and how you use this to save the changes. I thought I could could access dashboardStateChange from within the DOM when something happens, but even failing to understand how this is done.
Has anyone got any tips on saving the dashboard whenever its state has changed? I would like it to talk to a php script which saves the dashboard setup.
Unfortunately there aren't any great tutorials on this sort of functionality.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道这个问题是否仍然有趣,但我已经使用这个插件很长一段时间了,它实际上很容易使用。
几乎所有答案都可以在插件附带的示例中找到,对于您的问题,您可能需要查看以下示例代码,我用它来使仪表板的当前布局在服务器上持久化。
请注意,“saveID”是“保存”按钮的 ID,“saveConfiguration”是在服务器上保存布局的 URL。
I don't know if this question is still of interest but I've been using this plugin for quite a while and it's actually quite easy to use.
Pretty much all of the answer can be found in the example that comes with the plugin and to your problem you might want to have a look at the following example code that I use to make the current layout of the dashboard persistent on the server.
Please note that "saveID" is the ID of a Save button and "saveConfiguration" is the URL that save the layout on the server.
您可以使用内置的仪表板功能来快速保存简单的。在初始化仪表板的页面上,将其放在
initDashboard()
函数之后,但在dashboard.init()
之前:然后放置一个带有以下内容的 Button 或 Link HTML 代码中某处的 id
savebutton_id
。当您单击它时,仪表板会将序列化配置发送到您预定义的stateChangeUrl
。You can use the built in dashboard function to save quick & easy. On the page where you init the dashboard, put this after the
initDashboard()
function, but before thedashboard.init()
:Then you put a Button or Link with the id
savebutton_id
somewhere in your HTML-Code. When you click it, the dashboard will send the serialized configuration to your predefinedstateChangeUrl
.