healkiss/listitems

Allow to use jquery render easily. With a bit php you can use search, filter and pagination. Js is provided in the library

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

dev-master 2014-10-28 19:35 UTC

This package is not auto-updated.

Last update: 2025-07-01 07:35:59 UTC


README

WHAT:

Allow to use jquery render easily.

(With a bit php you can add search, filter and pagination. Js and html are provided in the library for these purposes.)

USE:

If you want the pagination, install http://botmonster.com/jquery-bootpag/#.VBGuVmB_tcY (fixes are included in the files template.js)

SETUP:

Add an id, a data-itemtype and a data-url in the main DIV

<div  id="articles-list"
      data-itemtype="article" 
      data-url= "{{ path('get_articles') }}">

Set a data-bind in each block you want dynamic

<div>
    <a data-bind='publisher'>/a>
    <em data-bind='postDate'></em>
</div>

Set a case in Singleton.listItems

case "article":
  this.displayList = this.displayArticles;
  break;

In proto.displayArticles add a directive for each data-bind

postDate: {
    text: function(params) { return this.postDate; },
},
publisher: {
    text: function(params) { return this.publisherName; },
    href: function(params) { return this.publisherPath; },
},

The url need to return a 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();