grid.collect();
}
- controls.prepend = function(resetSort, limit) {
- grid.prepend(resetSort, limit);
+ controls.prepend = function(limit) {
+ grid.prepend(limit);
}
controls.setLimit = function(limit,forget) {
});
}
- grid.prepend = function(resetSort, limit) {
+ grid.prepend = function(limit) {
var ran_into_duplicate = false;
var sort = grid.dataProvider.sort;
if (sort && sort.length) {
- // if sorting is in effect, we have no
- // have no way here of knowing which row
- // was most recently added nor that it
- // belongs on top of the visible set of rows,
- // so we default to a full collect()
- if (resetSort) { // and offset
- grid.dataProvider.sort = [];
- grid.offset = 0;
- }
- grid.collect();
- return;
+ // If sorting is in effect, we have no way
+ // of knowing that the new item should be
+ // visible _if the sort order is retained_.
+ // However, since the grids that do prepending in
+ // the first place are ones where we always
+ // want the new row to show up on top, we'll
+ // remove the current sort options.
+ grid.dataProvider.sort = [];
}
if (grid.offset > 0) {
// if we're prepending, we're forcing the
if (grid.collecting) return; // avoid parallel collect() or prepend()
grid.collecting = true;
console.debug('egGrid.prepend() starting');
+ // Note that we can count on the most-recently added
+ // item being at offset 0 in the data provider only
+ // for arrayNotifier data sources that do not have
+ // sort options currently set.
grid.dataProvider.get(0, 1).then(
null,
null,