healkiss / listitems
允许使用jQuery轻松渲染。使用一点PHP,你可以使用搜索、筛选和分页。库中提供了Js。
dev-master
2014-10-28 19:35 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-09-24 03:17:22 UTC
README
WHAT
允许使用jQuery轻松渲染。
(使用一些PHP,你可以添加搜索、筛选和分页。库中提供了用于这些目的的Js和html。)
USE
如果你需要分页,安装 http://botmonster.com/jquery-bootpag/#.VBGuVmB_tcY(修复已包含在template.js文件中)
SETUP
在主DIV中添加一个id、一个data-itemtype和一个data-url
<div id="articles-list" data-itemtype="article" data-url= "{{ path('get_articles') }}">
为每个你想动态设置的块设置一个data-bind
<div> <a data-bind='publisher'>/a> <em data-bind='postDate'></em> </div>
在Singleton.listItems中设置一个case
case "article": this.displayList = this.displayArticles; break;
在proto.displayArticles中为每个data-bind添加一个指令
postDate: { text: function(params) { return this.postDate; }, }, publisher: { text: function(params) { return this.publisherName; }, href: function(params) { return this.publisherPath; }, },
URL需要返回一个Json(phpArray)。
USE
entity.setTabsClicks(); //if you need tabs entity.setSelectFilter(); //if you need filters entity.setCheckboxClicks(); //if you need checkbox entity.setSearch(); //if you need search bar entity.list();