improving the html table

43
Leif Åstrand Product Manager Improving the HTML table a quick guide on getting in over your head lördag 24 januari 15

Upload: lastrand

Post on 16-Jul-2015

1.249 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Improving the HTML Table

Leif ÅstrandProduct Manager

Improving the HTML tablea quick guide on getting in over your head

lördag 24 januari 15

Page 2: Improving the HTML Table

Demo

lördag 24 januari 15

Page 3: Improving the HTML Table

Technical stuff

lördag 24 januari 15

Page 4: Improving the HTML Table

Escalator

DOM

Grid

DataSource

Column

Scrolled to row 15

Show data for row 15in these DOM elements

Get data for row 15 Extract cell value from row object and show it in this element

Renderer

Show value in element

lördag 24 januari 15

Page 5: Improving the HTML Table

Smooth scrolling

lördag 24 januari 15

Page 6: Improving the HTML Table

Row 1

Row 6

Row 7

Row 8

Row ...

Row 2

Row 3

Row 4

Row 5

lördag 24 januari 15

Page 7: Improving the HTML Table

Row 1

Row 6

Row 7

Row 8

Row ...

Row 2

Row 3

Row 4

Row 5

lördag 24 januari 15

Page 8: Improving the HTML Table

Row 2

Row 3

Row 4

Row 5

lördag 24 januari 15

Page 9: Improving the HTML Table

Row 3

Row 4

Row 5

lördag 24 januari 15

Page 10: Improving the HTML Table

Row 3

Row 4

Row 5

Row 6

lördag 24 januari 15

Page 11: Improving the HTML Table

Row 3

Row 4

Row 5

Row 6

lördag 24 januari 15

Page 12: Improving the HTML Table

Row 3

Row 4

Row 5

Row 6

lördag 24 januari 15

Page 13: Improving the HTML Table

Row 4

Row 5

Row 6

Row 7

lördag 24 januari 15

Page 14: Improving the HTML Table

Row 4

Row 5

Row 6

Row 7

lördag 24 januari 15

Page 15: Improving the HTML Table

Row 4

Row 5

Row 6

Row 7

Row 4

lördag 24 januari 15

Page 16: Improving the HTML Table

Row 5

Row 6

Row 7

Row 8

Row 8

lördag 24 januari 15

Page 17: Improving the HTML Table

will-change: transform;transform: translate(0, -y);

transform: translate3d(0, -y, 0);

top: y;

GPU acceleration

lördag 24 januari 15

Page 18: Improving the HTML Table

without screwing up focusRestore order

lördag 24 januari 15

Page 19: Improving the HTML Table

Touch scrolling

lördag 24 januari 15

Page 20: Improving the HTML Table

-webkit-overflow-scrolling: touch;

Flick scrolling

lördag 24 januari 15

Page 21: Improving the HTML Table

No scroll events?lördag 24 januari 15

Page 22: Improving the HTML Table

public void onTouchStart(TouchStartEvent event) { if (onlyOneFinger(event)) { cancelMomentumScrolling(); saveStartCoordinates(event); }}

public void onTouchMove(TouchMoveEvent event) { if (onlyOneFinger(event)) moveByEvent(event);}

public void onTouchEnd(TouchEndEvent event) { if (onlyOneFinger(event)) startFlickScroll(event);}

Manual scrolling

lördag 24 januari 15

Page 23: Improving the HTML Table

AnimationScheduler scheduler = AnimationScheduler.get();

public void moveByEvent(TouchMoveEvent event) { lastMoveEvent = event; scheduler.requestAnimationFrame(mover, element);}

AnimationCallback mover = new AnimationCallback() { public void execute(double timestamp) { lastMoveTimestamp = timestamp; actuallyMoveByEvent(lastMoveEvent); }}

Frame by frame

lördag 24 januari 15

Page 24: Improving the HTML Table

public void startFlickScroll(TouchEndEvent event) { scheduler.requestAnimationFrame(flick, element);}

AnimationCallback flick = new AnimationCallback() { public void execute(double timestamp) { double time = timestamp - lastMoveTimestamp;

if (startSpeed = -1) startSpeed = lastMovementDelta / time; if (moveByTime(startSpeed, time)) scheduler.requestAnimationFrame(this, element); }}

Flick scrolling

lördag 24 januari 15

Page 25: Improving the HTML Table

Lazy loading

lördag 24 januari 15

Page 26: Improving the HTML Table

public abstract class AbstractRemoteDataSource { public abstract void getRow(int rowIndex, RequestRowCallback callback);}

Get a row

lördag 24 januari 15

Page 27: Improving the HTML Table

public abstract class AbstractRemoteDataSource { public Row getRow(int index) { … };

protected abstract void requestRows(int start, int count, RequestRowsCallback callback);}

Cache rows

lördag 24 januari 15

Page 28: Improving the HTML Table

public abstract class AbstractRemoteDataSource { public Row getRow(int index) { … };

protected abstract void requestRows(int start, int count, RequestRowsCallback callback);

public void ensureAvailability(int start, int count) { … };}

What to cache?

lördag 24 januari 15

Page 29: Improving the HTML Table

Pixel limits

lördag 24 januari 15

Page 30: Improving the HTML Table

Detached scrollbars

lördag 24 januari 15

Page 31: Improving the HTML Table

Detached scrollbars

lördag 24 januari 15

Page 32: Improving the HTML Table

Detached scrollbars

lördag 24 januari 15

Page 33: Improving the HTML Table

Detached scrollbars

lördag 24 januari 15

Page 34: Improving the HTML Table

Detached scrollbars

lördag 24 januari 15

Page 35: Improving the HTML Table

Building a scrollbar

lördag 24 januari 15

Page 36: Improving the HTML Table

Building a scrollbar

lördag 24 januari 15

Page 37: Improving the HTML Table

<div class="outer"> <div class="inner"></div></div>

.outer { overflow-y: scroll; width: <native-scrollbar-height>; height: <body-viewport-width>;}

.inner { width: <native-scrollbar-height>; height: <body-content-width>;}

Building a scrollbar

lördag 24 januari 15

Page 38: Improving the HTML Table

Learn more

lördag 24 januari 15

Page 39: Improving the HTML Table

/client/src/com/vaadin/client/widgets/Grid.javagithub.com/vaadin/vaadin

lördag 24 januari 15

Page 40: Improving the HTML Table

groupId:artifactId:

version:

vaadin-widgets.jarcom.vaadinvaadin-widgets7.4.0.beta2

lördag 24 januari 15

Page 41: Improving the HTML Table

<inherits name='com.vaadin.Vaadin'/><inherits name='com.vaadin.themes.Valo'/>

Using vaadin-widgets

lördag 24 januari 15

Page 42: Improving the HTML Table

github.com/Artur-/grid-gwt

lördag 24 januari 15

Page 43: Improving the HTML Table

Questions?

Answers?

Please rate the talk at gwtcreate.com/agenda? [email protected]

lördag 24 januari 15