added javascript paginator method that returns a pagination object