之前在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。但我沒成功過。如知道緣由的朋友懇請告之。