stakbit/jQuery-Mobile-Listview-Pagination-Plugin — pull request #7 by rovolution (2013-04-26 17:51:41+00:00)
Title: adding in ability to pass context object to ajaxCallBack via the native ...

To Whomever It May Concern,

I recently began working on a jquery-mobile based application and was looking for a cool plugin that allowed for pagination/lazy loading of jqm lists. I did a Google search and found your plugin. So far I'm a big fan! It really addresses the core problems I had!

However, the app I am working on also implements Backbone.js for code structure/organization. As I was integrating your library into my application, I wanted a way to be able to pass the context of my Backbone View into the callback function registered by the $.mobile.listomatic.prototype.registerAjaxCall() function. This is so that when the success callback was triggered, I could directly add the returned data into the Backbone Collection associated with my Backbone View that wraps my listview.

Therefore I made some slight modifications to your code that allow the user to pass an additional context object into the registerAjaxCall() function. When the callback is invoked by the listomatic code, it first checks to see if a context object is set. If so, it calls the callback using the native .call() method, passing in the registered context object. If no context object is set, it just calls it without the context object.

Let me know what you think! I believe this would be a really useful addition to this library.

Thanks!
-Rohit K