Skip to content

piglovesyou/closure-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goog.ui.List

Faster List UI for PC and Mobile.

Demo

  1. Clone this project and change directory into it.
  2. node server.js to start a demo server.
  3. Access localhost:1337 in your browser.

Fast because:

  • It renders only DOMs to display.
  • It fetches only data to display from a server.
  • It uses a browser native scroller (overflow:auto).
  • It caches data in goog.ds.DataNode which another compnent can refer to.

Usage

// A row renderer. It gets item data from JSON and has to return (html) string.
function renderer(data) {
  return 'id: ' + data['id'] + '  title: ' + data['title'];
}

var data = new goog.ui.list.Data('/api' // Url to request a remote JSON to
                                 50);   // Optional: Total count of all items. You can lazily pass it.

// Decorating example
var list = new goog.ui.List(renderer, // Set row renderer, or you can pass a subclass of goog.ui.List.Item.
                            5);       // Optional: Item count per a request. Default is 25.
list.setData(data); // Set data object a list refers to
list.decorate(listElem1);

// Rendering example
var list2 = new goog.ui.List;
list2.setData(data);
list2.render();

Test

Open piglovesyou/goog/ui/list/list_test.html in a browser.

License

# Preparing in progress.

About

Faster List UI for PC and Mobile.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published