John Lindal![]()
A MultiObject exposes the same API as each individual object (both functions and events), and the state of all the objects is kept in sync. The objects must maintain all state via Y.Attribute. One example use-case is for multiple Paginator widgets in different locations, e.g., one on top and one at the bottom of a table.
Create several paginators and manage them all via MultiObject.
YUI().use('gallery-multiobject', 'gallery-paginator', function(Y)
{
function update(
/* object */ state)
{
this.setPage(state.page, true);
this.setRowsPerPage(state.rowsPerPage, true);
}
var p1 = new Y.Paginator(...);
var p2 = new Y.Paginator(...);
var p3 = new Y.Paginator(...);
var p = new Y.MultiObject([p1, p2, p3]);
p.on('changeRequest', update, p);
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info