logo

/Virtual Scrolling|v2.1.2

Class

new VirtualScroll(container, options)virtualScroll.jsline 49

Virtual scroll component.

PARAMETERS
NameTypeDescription

container

HTMLElementString

container element or id

options

object

virtual scroll component options

PROPERTIES
NameTypeDescription

items

Array

items

spareItemCount

Number

count of spare items for display items

itemHeight

Number

item height

threshold

Number

pixel height from edge(start, end) of content
for determining need emit scrollTop, scrollBottom event

containerHeight

Number

container height

scrollPosition

Number

scroll position

usageStatistics

Boolean = true|false

send hostname to google analytics default value is true

EXAMPLES
var VirtualScroll = tui.VirtualScroll; // require('tui-virtual-scroll');
var container = document.getElementById('virtual-scroll-container');
var instance = new VirtualScroll(container, {
    scrollPosition: 0,
    itemHeight: 150,
    spareItemCount: 5,
    layoutHeight: 400,
    items: items
});

Instance Methods

append(items)virtualScroll.jsline 572

Append items.

PARAMETERS
NameTypeDescription

items

Array.<{height: ?Number, contents: String}>

items

clear()virtualScroll.jsline 678

Clear items.

destroy()virtualScroll.jsline 746

Destroy.

getItemCount()virtualScroll.jsline 731

Get item count.

RETURNS:
{

Number

}

getItems()virtualScroll.jsline 723

Get items.

RETURNS:
{

Array.<String>

}

getScrollPosition()virtualScroll.jsline 739

Get current scroll position value.

RETURNS:
{

Number

}

insert(items, index)virtualScroll.jsline 595

Insert items.

PARAMETERS
NameTypeDescription

items

Array.<{height: ?Number, contents: String}>

items

index

number

index

moveScroll(scrollPosition)virtualScroll.jsline 689

Move scroll position.

PARAMETERS
NameTypeDescription

scrollPosition

Number

scroll position

prepend(items)virtualScroll.jsline 582

Prepend items.

PARAMETERS
NameTypeDescription

items

Array.<{height: ?Number, contents: String}>

items

remove(index, shouldRerender)virtualScroll.jsline 656

Remove item or items by index.

PARAMETERS
NameTypeDescription

index

Array.<Number>Number

remove item index or index list

shouldRerender

Boolean

whether should rerender or not

RETURNS:
{

Array.<{height: Number, contents: String}>Object

}

resizeHeight(height)virtualScroll.jsline 703

Resize layout height.

PARAMETERS
NameTypeDescription

height

Number

layout height

Events

scrollvirtualScroll.jsline 489

Occurs when the scroll event.

PROPERTIES
NameTypeDescription

eventData

object

event data

PROPERTIES
NameTypeDescription

scrollPosition

number

current scroll position

scrollHeight

number

scroll height

movedPosition

number

moved position

scrollBottomvirtualScroll.jsline 503

Occurs when the scroll position is arrived bottom.

PROPERTIES
NameTypeDescription

eventData

object

event data

PROPERTIES
NameTypeDescription

scrollPosition

number

current scroll position

scrollHeight

number

scroll height

scrollTopvirtualScroll.jsline 512

Occurs when the scroll position is arrived top.

PROPERTIES
NameTypeDescription

eventData

object

event data

PROPERTIES
NameTypeDescription

scrollPosition

number

current scroll position

scrollHeight

number

scroll height

Resizable