GithubHelp home page GithubHelp logo

test-mass-forker-org-1 / backbone-virtualized-listview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/backbone-virtualized-listview

0.0 0.0 0.0 1 MB

Backbone list view with virtualization support

JavaScript 99.08% HTML 0.92%

backbone-virtualized-listview's Introduction

NPM version Build Status Dependency Status Coverage percentage

Backbone list view with virtualization support

UI virtualization is essential to your Web UI performance in case you have thousands of data item to render. The idea is to skip rendering the off screen items and replace them with filler blocks. You need to handle the scroll and resize events to adjust the DOM content.

The principle is straight forward, but the implementation is fussy. This Backbone based implementation is aiming to create a general purposed virtualized view with high quality and performance, so that people can focus more on the user experience instead of the complexity of virtualization.

Features

Customization

The ListView is named as "list view", but it's not necessarily to render a list. You can customize it into a TABLE, or a sequence of DIVs with the listTemplate and the itemTemplate options.

Refer to the document for detail

Scroll to item

You can scroll a certain item into the viewport, method scrollToItem is the helper.

Refer to the document for detail.

Handling data change

When data is changed, you can update the view with the set method.

Refer to the document for detail.

Installation

# install the module
npm install --save backbone-virtualized-listview
# install the peer dependencies
npm install --save jquery underscore backbone fast-binary-indexed-tree

Usage

Refer to the document for details.

import _ from 'underscore';
import ListView from 'backbone-virtualized-listview';
import listTemplate from 'my-list-template.jade';
import itemTemplate from 'my-item-template.jade';

const listView = new ListView({
  el: '.container',
}).set({
  items: _.map(_.range(2000), i => { text: i }),
  listTemplate,
  itemTemplate,
});
listView.render();

// Scroll to item
listView.scrollToItem(100);

License

MIT

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

backbone-virtualized-listview's People

Contributors

lyweiwei avatar wewei avatar msftgits avatar ljqx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.