jQuery 移动和JS 框架
在我的工作中,我们有一个现有的 ASP.NET Web 应用程序,并且正在复制一些页面和内容。更好地瞄准我们的移动用户的功能。我们使用 jQuery Mobile 框架和 ASP.NET Web 窗体来执行此操作。
由于这将针对移动网络,我希望它能够快速且稳定。轻量级,这意味着关闭视图状态,按需加载列表(打开时),并且我想消除回发(烦人且不能很好地使用 jQuery Mobile)。当然,这意味着在客户端做更多的工作。
其中一个页面有点复杂,它允许用户记录项目,但它的布局是完全可定制的。在记录之前,用户能够定义他们希望跟踪的字段。其中一些字段是系统指定的,但其他字段是由用户创建的。他们可以从复选框、下拉列表、日期框、单选按钮、文本框或列表框中进行选择。某些字段还与其他字段相关联,这意味着用户可以在一个下拉列表中选择一项,然后使用关联数据重新加载另一个下拉列表。用户还可以在用于记录其项目的实际页面上添加无限数量的附加字段(下拉列表)。用户填写页面后,所选字段值将保存回服务器的数据库表中。
我认为这将是使用像 Knockout.js 这样的 JS 框架的绝佳机会,依赖项跟踪对于尝试保持事物同步和同步非常有用。根据其他列表中所做的选择,根据需要重新加载列表。尽管我有点担心它将如何处理表单布局是动态的和动态的这一事实。显示后可以修改(有人知道它是否可以处理这个问题吗?)。
所以我开始寻找 jQuery Mobile 和 jQuery Mobile。 Knockout.js 显然存在问题、解决方法、限制等。两者一起工作,我在 Backbone.js 中看到了同样的事情,
有人对此有什么建议吗?是否值得尝试使用某种带有 jQuery Mobile 的 JS 框架? JS 框架可以处理我尝试创建的表单,而无需我费力吗?我是否最好寻找某种依赖性跟踪插件并使用它,如果是的话,您可以建议任何将连接到我的模型对象和模型对象的插件吗?页面上的其他控件jQuery Mobile 能正常工作吗?
At my work we have an existing ASP.NET web application and are duplicating some of the pages & functionality to better target our mobile users. We are using the jQuery Mobile framework and ASP.NET Web Forms to do this.
Since this is going to target the mobile web I would like it to be fast & lightweight which means turning off the view state, loading lists on demand (when opened), and I'd like to eliminate post backs (annoying & doesn't work well w/ jQuery Mobile). Of course this means doing a lot more work client side.
One of the pages is a bit complex, it allows the user to log items, however it's layout is fully customizable. Prior to logging the user is able to define what fields they wish to track. Some of these fields are system designated but others are created by the user. They can choose from a checkbox, dropdown list, date box, radio button, text box, or list box. Some fields are also tied to other fields meaning the user can select an item in one drop down list which then reloads another drop down list with the associated data. The user also has the ability to add an unlimited amount of additional fields (drop down lists) while on the actual page used to log their item. Once the page is filled out by the user the selected fields values are saved back to the server in a database table.
I figured this would be a great chance to use a JS Framework like Knockout.js, the dependency tracking would come in great for trying to keep things synced up & reload lists as needed based on selections made in other lists. Even though I am a bit concerned about how it would handle the fact that the form layout is dynamic & can be modified once displayed (anyone know if it can handle this?).
So I started looking around for jQuery Mobile & Knockout.js and apparently there are issues, workarounds, limitations, etc. w/ the two working together and I saw the same thing w/ Backbone.js
Does anyone have any suggestions w/ this? Is it worth the hassle to try and use a JS Framework of some sort w/ jQuery Mobile? Can a JS Framework handle the form I am trying to create w/o me having to jump through hoops? Am I better off looking for some sort of dependency tracking plugin and just using that and if so can you suggest any that will wire up to my model object & other controls on the page & work correctly w/ jQuery Mobile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
总的来说,淘汰赛应该很适合您的要求。我目前正在使用它作为 MVC3 应用程序来执行与您所描述的类似的操作。
对于复杂的页面,这都是可行的。
您的高度可定制的表单。这是淘汰赛真正大放异彩的领域之一。它允许将数据的显示方式和数据本身分开。这可以通过不同的数据绑定类型来完成,并且您可以添加自己的自定义绑定。实际上,在创建表单并尝试测试控件类型时,我经常这样做。
动态布局 - 使用 Knockout,DOM 和数据之间没有直接连接。 Knockout 的数据绑定语句允许您在运行时将新内容连接到其数据。目前,这在我当前的应用程序中运行良好。
一般来说,在淘汰赛中,一旦我开始使用ajax来处理我所有的数据要求,事情就变得大大简化了。
至于在 jQuery Mobile 中使用 Knockout,Knockout 现在是 Asp.Net Mvc4 开发者预览版新版本的一部分。据我了解,knockout 是 MVC 离线构建单页 Web 设计的关键,其中数据存储在本地,然后动态添加到显示的页面。无法找到正确的链接,但我会继续查找并稍后进行编辑。
希望这会有所帮助。另外,请查看 knockoutjs.net 主页上的链接。 -
Overall, knockout should be a good fit for your requirements. I'm currently using it an MVC3 applicaiton to do similar things to what you are describing.
As for your complex page, this is all doable.
Your highly customizable form. This is one area where knockout really shines. It allows a separation be how data is displayed and the data itself. This can be done with different data-bindings types and you can add your own customized bindings. I actually do this a lot when creating a form and experimenting with what the test control type is.
Dynamic Layout - With Knockout there is no direct connection between the DOM and the data. Knockout's data-bind statements allow you to connect new content to it's data at run time. This currently works well in my current app.
In general with knockout, once I went to using ajax to handle all my data requirements, things became greatly simplified.
As far as using knockout with jQuery mobile, knockout is now part of the new releases of Asp.Net Mvc4, developer preview. It is my understanding that knockout is key to MVC's design on building single page web offline where the data is stored locally, then dynamically added to the displayed page. Cannot find link right know, but I'll keep looking and post edit later.
Hope this helps out. Also, checkout the links on knockoutjs.net home page. -