Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

ListViewController: extract index decision to its own method #56

Merged
merged 1 commit into from
Aug 5, 2014

Conversation

usirin
Copy link
Member

@usirin usirin commented Aug 5, 2014

This PR introduces a change to KDListViewController with extracting the decision of index depending on lastToFirst option to its own method. This gives us some advantages:

  • It can be overriden by subclasses so that those can have their own mechanism.
  • Remove hard dependency of lastToFirst.

# conditions. e.g `options.lastToFirst`
# This method can be overriden by subclasses
# to change the item order and get necessary index.
getRealIndex: (index) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename the method as getIndex?

@usirin
Copy link
Member Author

usirin commented Aug 5, 2014

@sinan updated.

sinan added a commit that referenced this pull request Aug 5, 2014
ListViewController: extract index decision to its own method
@sinan sinan merged commit 133894d into koding:master.listview Aug 5, 2014
@canthefason
Copy link
Contributor

I am suggesting to change name of the lastToFirst option. It misleads people (me :) ) in our use case:

For our message pane we are fetching data from api by descending order, and setting lastToFirst=no. And for private messages, again data fetch is in descending order, but this time we set lastToFirst=yes.

In both cases data is fetched in same sorting order, therefore i am suggesting naming lastToFirst option as reverseOrder, which is i think more explicit about its behaviour.

@sinan
Copy link
Member

sinan commented Aug 5, 2014

I agree that lastToFirst is confusing, i felt the same way in a few instances. We can change the name but i don't think reverseOrder is any better than lastToFirst, how about
options.order or= 'ascending' # or 'descending'?

@szkl
Copy link
Member

szkl commented Aug 5, 2014

Behavior of add and remove methods of list view depends on that option. Order by asc/desc would make me ask order by asc/desc of what or how? I'd rather prefer option name lastToFirst or reverseOrder. Another alternative would be option called direction or orientation with values up and down.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants