New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination on scroll end for REST services #44

Closed
dev-rke opened this Issue Aug 23, 2015 · 7 comments

Comments

Projects
None yet
3 participants
@dev-rke

dev-rke commented Aug 23, 2015

I just thought about if it might be possible to define an event before further
data will be appended e.g. using ajax like for paginated data.

E.g. you load page one from a REST service and want to load additional pages when the user scrolls down to the end and before he reaches the end further data will be loaded.

Pseudocode:

// user defined setting
options.percentageScrollOffsetBeforeLoadData = 0.95;

// clusterize
if(options.loadDataCallback()) {
  $elementWithScrollbar.on('scroll',function(e) {
    percentageScrollOffset = $(this).scrollTop / totalheight;
    if(percentageScrollOffset > options.percentageScrollOffsetBeforeLoadData) {
      options.loadDataCallback()
    }
  });
}

This would enable the user to handle additional page loads without manually
injecting in the event handling of clusterize.

@NeXTs NeXTs added the enhancement label Aug 25, 2015

@NeXTs

This comment has been minimized.

Show comment
Hide comment
@NeXTs

NeXTs Aug 25, 2015

Owner

Hi, this is good idea.
In the nearest future I will implement list of callbacks and events for most useful needs. Probably I'll consider this case too.

Questions to developers: do you need this feature? Should I increase the plugin's size by this functionality ?

Owner

NeXTs commented Aug 25, 2015

Hi, this is good idea.
In the nearest future I will implement list of callbacks and events for most useful needs. Probably I'll consider this case too.

Questions to developers: do you need this feature? Should I increase the plugin's size by this functionality ?

@dev-rke

This comment has been minimized.

Show comment
Hide comment
@dev-rke

dev-rke Aug 25, 2015

If you want to keep it small, it might also be a good alternative just to expose some hooks where one can enhance the functionality with a custom implementation.

Another alternative might be to split the functionality in two modules: a very small core module and an extended feature module, which hooks into the core.

dev-rke commented Aug 25, 2015

If you want to keep it small, it might also be a good alternative just to expose some hooks where one can enhance the functionality with a custom implementation.

Another alternative might be to split the functionality in two modules: a very small core module and an extended feature module, which hooks into the core.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 13, 2015

Yep, it's worth of it. Hope will be impelmented

ghost commented Oct 13, 2015

Yep, it's worth of it. Hope will be impelmented

@Abhinav1217

This comment has been minimized.

Show comment
Hide comment
@Abhinav1217

Abhinav1217 Oct 16, 2015

I would like to not increase the size of the plugin for this feature. But to expose some callback hooks which can be used to extend core plugin with all the extra functionalities including this.

I would like to not increase the size of the plugin for this feature. But to expose some callback hooks which can be used to extend core plugin with all the extra functionalities including this.

@NeXTs NeXTs closed this in 2878963 Nov 11, 2015

@NeXTs

This comment has been minimized.

Show comment
Hide comment
@NeXTs

NeXTs Nov 11, 2015

Owner

Now you able to subscribe to update scroll position via scrollingProgress callback. Or get progress position directly via calling getScrollProgress method.

var clusterize = new Clusterize({
  rows: data,
  scrollId: 'scrollArea',
  contentId: 'contentArea',
  callbacks: {
    scrollingProgress: function(progress) {
      if( progress > 80 ) {
        // do stuff
      }
    }
  }
});

// or call it directly
console.log(clusterize.getScrollProgress());
Owner

NeXTs commented Nov 11, 2015

Now you able to subscribe to update scroll position via scrollingProgress callback. Or get progress position directly via calling getScrollProgress method.

var clusterize = new Clusterize({
  rows: data,
  scrollId: 'scrollArea',
  contentId: 'contentArea',
  callbacks: {
    scrollingProgress: function(progress) {
      if( progress > 80 ) {
        // do stuff
      }
    }
  }
});

// or call it directly
console.log(clusterize.getScrollProgress());
@Abhinav1217

This comment has been minimized.

Show comment
Hide comment
@Abhinav1217

Abhinav1217 Nov 12, 2015

Will try this today. Thanks.

Will try this today. Thanks.

@dev-rke

This comment has been minimized.

Show comment
Hide comment
@dev-rke

dev-rke Nov 12, 2015

Great! Thank you! :-)

dev-rke commented Nov 12, 2015

Great! Thank you! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment