Is there a handler for after the grid has finished loading in SmartGWT? - smartgwt

I want to do something after my listgrid has finished all its data, but I am not sure if there is a handler out there to do this? I tried to use DataArrivedHandler, but that is not correct because it fires way too many times as data are loading. Is there something i can do to achieve this?

Related

iOS tableview animated placeholder

Is it possible to use below library in ios when the tableview data is getting from server. Initially the row count will be zero until we get the data from server.
https://github.com/malkouz/ListPlaceholder
https://github.com/samhann/Loader.swift
Please help me if its possible using this.
I need to show FB like placeholder in tableview until I get data from server.
It certainly looks like it does what you want - although I'm not sure how customisable it is? Grab the 'Example' project and have a play!
However, I'd suggest taking a different approach and just return a row count of 1 while your loading your data. Then in your cellForRowAt: method create a 'loading cell' if your still loading which you can style to look exactly how you want. When your data finishes loading just call reloadData on your tableview, this time returning the correct row count and returning your fully populated cells.

CollectionView realoadData index out of range

I'm trying to fetch some data from coreData and display it in collectionView. Pretty basic. I do this on a background thread and then call reloadData on the main, as seen in the images.
But the problem is that sometimes it works and sometimes it doesn't, giving me index out of range. And I observed that when it crashes it enters some delegate method of collection view and not viewWillAppear
Edit: Here Is the code
You may have more than one problem. But, the first one would be that you didnt initialise the data containers. The collectionView delegate methods will be called before viewWillAppear. Try to intialise the containers in the viewDidLoad:
thumbnailsForSections = [String:[Thumbnails]]()
Core data is not thread safe. You cannot store NSManagedObjects that were retrieved from a background thread and use them in the main thread.
Consider doing the fetch on the main thread or using a NSFetchedResultsController. This should not under normal circumstance take a long time even for a large amount of data. If this is taking a long time take a closer look at you data model or your predicate.
If want to continue using a background thread then you have to copy the values stored in NSManagedObject into a different thread-safe object (ie a custom NSObject subclass or a dictionary).
Guys thank you for your trouble but i managed to obtain what i wanted.
I didn't solve the background issue instead i eliminated it. All i wanted to obtain was an activity indicator playing while the data was loaded from CoreData.
And by eliminating the queues it worked, which is pretty logical now that i think because i start the animation on the main thread and stop it after the whole data was loaded. So it seems the main thread "can do 2 things at the same time" ? :)

UICollectionView loads async image in different cells due to reload during async image downloading

When loading my UICollectionView cells I call a method which downloads an image async.
During the download however, my collection view is reloaded and so when the async image is downloaded it is set in two different cells.
I have also tried using an NSOperationQueue where in dealloc I call cancelAllOperations:, but this didn't work.
What is the best way to cancel this download and can someone provide some sample code?
Thanks.
I think the best practice is to launch requests lazily as you need the images, cache the results, and have no expectations about the state of the collection when the request completes.
Reloading the collection is not an invalidating event for a request for an image in a certain cell. Scrolling away is, but the user might scroll back. So make the request, and in the completion block for the request cache the result and reloadItemsAtIndexPaths: on the index path associated with the request.
My answer here, provides working code.

Web services data is coming late and table view is empty

I am new to ios sdk, working on app which includes web service calling and parsing JSOn.i have two view controllers on first view i am calling web service on button click and in second view i have to display all record in table view. everything working well , parsing values are also coming properly. but values are coming late and table is displaying empty values. but when i am navigating back and coming again then it will display all button.How to handle this situation?
The beauty of Asynchronous download is making things ready for us in other than main thread. All UI components gets updated by Application main thread, In your case TableView UI updating on main thread and downloading happening in separately. I guess only thing you might missed here is, after downloading finished not getting the notification. Once you arrange notification after downloading process finished, just update your tableView by calling [tableviewobject reload];. Which ll done all reloading of the tableview(this is nothing but refreshing all tableview again). Good luck.
Are you reloading the table view once the data has been downloaded?
Something like this in your Table view controller:
[self.tableView reload];

UITableView does not respond normally when I scroll during loading

I have come across a very tedious problem. When I try to load data asynchronously and then finally call -reloadData the tableview does not decelerate upon a scroll event and does not respond to touch events. How can I prevent this from happening ?
There is a table view with some data in it. The user is manipulating the table as new data comes in asynchronously. The proper way to modify the table is to not use reload data, but to use the "insert..." methods, which leave existing cells alone.

Resources