Knockout JS - 表格(网格)中的级联下拉列表
我正在尝试使用 MVC3 和 MVC 实现级联下拉菜单的场景。淘汰赛JS。
示例场景:下面是 html 表格,其中第二列和第三列作为下拉列表,想要以级联样式实现它,例如列下拉列表应根据表下拉选择进行填充。
ColumnName Table-DropDown Column-DropDown DefaultValue
Test1 Table1 Table1-Columns ‘’
Test2 Table2 Table2-Columns ‘’
有一个示例 http://knockoutjs.com/examples/cartEditor.html 但无法获得包含所有 JSON 数据的完整代码,因此无法弄清楚如何准确地实现这一点,非常感谢对此的帮助。
I am trying to implement a scenario of cascading dropdown with MVC3 & Knockout JS.
Example Scenario: below is the html table has 2nd and 3rd columns as dropdowns, want to implement it in cascading style, like column-dropdown should be populated based on the Table-Dropdown selection.
ColumnName Table-DropDown Column-DropDown DefaultValue
Test1 Table1 Table1-Columns ‘’
Test2 Table2 Table2-Columns ‘’
Got an example http://knockoutjs.com/examples/cartEditor.html
But could not get the complete code with all JSON data, so not able to figure out how exactly to implement this, help on this really appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想了解购物车示例,那么它会从以下资源文件获取数据:
http ://knockoutjs.com/examples/resources/sampleProductCategories.js
这应该可以帮助您了解一切是如何工作的,然后您可以进行调整,使其满足您的表名称/列名称场景。
为了完整起见,以下是文件的内容。
If you just want to understand the cart example, then it is getting its data from a resource file at:
http://knockoutjs.com/examples/resources/sampleProductCategories.js
This should help you understand how everything is working and you can then adapt so it meets your Table Name / Column Name scenario.
For completeness, here is the content of the file.