Skip to content

Commit

Permalink
TableView has a new helper methods to scroll desired column or row po…
Browse files Browse the repository at this point in the history
…sition
  • Loading branch information
evrencoskun committed Jan 21, 2018
1 parent 8a7f843 commit 06edc9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.evrencoskun.tableview.ITableView;
import com.evrencoskun.tableview.layoutmanager.CellLayoutManager;
Expand All @@ -24,6 +25,12 @@ public ScrollHandler(ITableView tableView) {
}

public void scrollToColumnPosition(int columnPosition) {
// TableView is not on screen yet.
if (!((View) mTableView).isShown()) {
// Change default value of the listener
mTableView.getHorizontalRecyclerViewListener().setScrollPosition(columnPosition);
}

// Column Header should be scrolled firstly because of fitting column width process.
scrollColumnHeader(columnPosition);
scrollCellHorizontally(columnPosition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,11 @@ public int getScrollPositionOffset() {
public void setScrollPositionOffset(int p_nOffset) {
m_nScrollPositionOffset = p_nOffset;
}

/**
* To change default scroll position that is before TableView is not populated.
*/
public void setScrollPosition(int position){
this.m_nScrollPosition = position;
}
}

0 comments on commit 06edc9f

Please sign in to comment.