Hi - I'm implementing both features mentioned above in one grid. The problem I am having is that when I implement the Pull Down to Reload feature it is making an addtional call out to the IGGridViewDataSourceHelperLoadMoreDelegate.LoadMoreRows method. In other words when my view controller loads its making a call out to LoadMoreRows and I don't want it too and it's happening when I am implementing the Pull down to refresh feature.
If I comment out the:
//Set the overridden delegate to implement pull down to refresh.
gridView.Delegate = new gridViewDelegate (this);
Then everything works fine on the LoadMoreRows.
Not sure if my ordering of code is not right or if I need to combine these. Can you assist, below are some of my code snippets.
GRIDSETUP:
//Set the overridden delegate to implement pull down to refresh. gridView.Delegate = new gridViewDelegate (this); //Next implement the load more helper dsh.LoadMoreDelegate = new LoadMoreHelper (gridView, this); //Next, set the data object dsh.Data = gridItemsSorted.ToArray (); // Set the DataSource gridView.DataSource = dsh; // Turn off empty rows gridView.EmptyRows = false;
CLASSES:
public class LoadMoreHelper : IGGridViewDataSourceHelperLoadMoreDelegate { #region Members IGGridView gridView; RecentTestsTableViewController mRecentTestsTableViewController; #endregion #region Constructor public LoadMoreHelper (IGGridView GridView, RecentTestsTableViewController recentTestsTableViewController) { gridView = GridView; mRecentTestsTableViewController = recentTestsTableViewController; } #endregion #region Data Source Helper Methods public override IGGridViewLoadMoreCell ResolveLoadMoreCell (IGGridView gridView) { IGGridViewLoadMoreCell cell = (IGGridViewLoadMoreCell)gridView.DequeueReusableCell ("LoadMore"); return cell; } public override bool NeedMoreRows (IGGridViewDataSourceHelper dataSource) { return dataSource.Data.Length < mRecentTestsTableViewController.mTotalRecords; } public override void LoadMoreRows (IGGridViewDataSourceHelper dataSource) { mRecentTestsTableViewController.mPage++; if (mRecentTestsTableViewController.lstFunctionalTestGroupSummary.Count > 0) mRecentTestsTableViewController.lstFunctionalTestGroupSummary.InsertRange (mRecentTestsTableViewController.lstFunctionalTestGroupSummary.Count - 1, LoadFunctionalTestGroup()); //Rebind the datasource dataSource.Data = mRecentTestsTableViewController.lstFunctionalTestGroupSummary.ToArray (); //Update the display gridView.UpdateData (); }
Thanks for your help as always. I really appreciate it. Turns out that I only had 13 records and for testing purposes a had it set to Load More on 12 records. For whatever reason it was just calling the load more automatically. Once I upped it to load more after 25 records it started working fine. 25 is what I want it at, but just had it at 12 for testing and for whatever reason it didn't like the low amount.
Hi!
The 2 should work together without issue. In fact the twitter scenario sample we have in our samples browser, actually uses both features.
I've attached a sample, that implements both in C#. However, i'm not seeing the issue you described. Can you try it out, and let me know if there are any differences between the way i implemented it and the way you did?
Thanks,
-SteveZ