之前在Part 1简单介绍了Veiw和JSONView。今天这里小弟为大家说说应用的案例,原本Jack的Image Chooser是一个非常好的案例,当中包含Jack大量的技巧,不过正因为这样,过于深奥,小弟我亦不能一时全盘吃透,只挑其“精妙”之处,与君共勉之!
本文包含四大知识点:1.在LayoutDialog中加入Tabs;2.View的使用方式;3.JSONView的使用方式;4.获取XML/JSON的fields值与分页
演示地址
【View之定义】
A View is generally used to build a quick template-based display of datamodel, rather than building a more complex grid. I thnk there's a blog post that illustrates doing this with JSON data. Templates can be used for any repetitious html creation, not necessarily tied to a datamodel.
主要的意思是View用于展示DataModel的数据,Part 1已经说过。这里是来自fourm某君的补充。
代码点评:
1.先看一段简单的
2.在LayoutDialog中加入Tabs
LayoutDialong分两个区域:west & center。而center之中我们要加入tabs,并逐一附加active的事件
4.JSONView的使用方式
5.获取XML/JSON的fields值与分页
这两个问题放在一起讨论的原因是至今我还不能实现。如果按照jack的办法:
可得到index但node.id无法获取。我只好用较丑陋的方式实现:
分页:
View的分页视乎应该通过DataModel。但我没成功过。如知道缘由的朋友恳请告之。