Say you have a view that displays a list of items. Clicking the item opens a modal sheet that allows the user to edit the item. On saving the sheet, the data is sent to the database to update and, on completion, the sheet is dismissed.
What's the best practice for updating the first view with the list of items? In my app, I'm currently using the "onDismiss" method to refresh the data from my cloud database (firestore).
However, there are cases when this doesn't work well. For example, if there's a cloud function that needs to run before the data is visible, then the data doesn't appear on the first refresh.
Is there a best practice for handling these types of updates?
Related
I’m having a play about with table views and saving data. I’ve managed to created an add button where you can add some data to a table view (like a to do list app) and it saves in user defaults. However, I can’t seem to figure out how to add and save data directly just by pressing an empty row in the table view. Basically, I would like to know how to add data and display data on a table view just like the stock To Do and Reminders app from Apple.
I’m working with Swift 4.
Any help or code examples would be much appreciated!
I'm creating an app and I need some help with design.
Launch Screen - I want to show 6-8 "category" buttons with labels loaded from an array ("normal" buttons from interface builder - not tab bar buttons or menu bar buttons).
Table Screen - When one of the category buttons is pushed on the launch screen, I want to show a table view with all of the items in that category.
Detail Screen - When one of the items on the table screen is selected, go to a new screen with details for the item. There will be an action button on this screen which will remove the item from the list if pressed.
My questions are as follows:
1) I don't want to show navigation buttons on the first screen. Can I still use a Navigation-Based application and hide the navigation controls on the first screen, or would it be better (easier) to create a view-based application and put a navigation controller "inside" one of the views? I'm totally open to any basic design approach suggestions you may have.
2) I've figured out how to create a sqlite3 file, add it to the project, query it, and generate the table view from the results, but I'm not sure about how to store the sqlite file in a way that will persist on the device when the user upgrades the app later. Any pointers on that?
Thanks for any help/links/documentation you can point me to. I've watched a million tutorials but none of the ones I've seen really address basic app design.
Now for Q1, both ways work fine but if you have buttons from the first screen, having a uinavigationcontroller might make it slightly easier if you plan to have back buttons on the screens after the first screen.
For Q2, to make the database persist when the user updates their app at some stage, simply keep the original database and include a new database (with a different name) with additional content, then modify your original database and import any additional content to it.
You can also do variations of that also, ie import content from old database to new database and etc. But the key is to keep the database file names different, ie add database_v1.sqlite, database_v2.sqlite and etc.
BTW don't forget to clean up any databases you won't use in future.
I am new to mvc and I have a question
I have a page (asp.net Mvc 3) called profile which contains 3 partial view called (1) Address,Qualification,Experience.
Each of the partial view should allow you to add its details and save it details/contents without affecting the others.
How can I attach an action to each partial view save button and postback the result without refreshing other partial view.
Can someone explain this to me with and without using jquery/ajax
without ajax or jquery you'd be stuck with doing something horrible like iFrames... Stick to jquery, it is the best and easiest way.
Actually, here is one way you might be able to do it.
Name the "Submit" buttons according to the method you want called. Then, have all of your 3 sets of data inputs within one <form></form> which posts to an intermediate Controller endpoint.
In the intermediate controller endpoint, determine which button was pressed, then pass the correct data to your normal control methods, and push all the other data back to the view. That way you can fill out all the inputs, click the appropriate submit button, then only the correct data gets used! Then all the other data gets pushed back to the view and the approprate input boxes get filled out.
I have an app based on a tab bar and data retrieved from the Internet. The main tab shows a map and one of the other tabs shows incidents around the center point of the map displayed using a UITableView. If the user moves the map and then moves to the incidents page, I need to refresh the list of incidents displayed in the table. To do this I request the incidents in viewWillAppear:animated: and when that completes (asynchronously) I call the table view's reloadData method.
This works beautifully unless the user taps between the tabs quickly (e.g. display incidents, move to map, move map, move back to incidents, move back to map, etc.). At some point the incidents data source (an NSArray) is modified while the table view is trying to access it.
Here is a question that is similar:
UITableView Crashes if Data Source Is Updated During Scrolling
One of the solutions for that question describes a solution at a high level that is exactly what I want: Freeze the data source while the table is being updated. The thing I can't figure out, however, is when to unfreeze the data source. The problem is I can't find any way to be notified when the table is done being updated.
Any ideas? How do I freeze the data source while the table is being updated and then unfreeze it once the table is done being updated?
Although I'd really like to receive a notification when the table view is done accessing the data source, I found that my problem was due to modifying the data container from the work thread. The answer to this question led me to the solution:
Refreshing XML data and updating a UITableView
What I do now is fill a separate array in the worker thread and then perform a selector on the main thread to swap the updated data into the data container used by the table view.
The problem is I can't find any way to
be notified when the table is done
being updated.
I think you can assume that the data is done being loaded by checking in tableView:cellForRowAtIndexPath: to see if the last row has been loaded.
I haven't tested it, just making an assumption based on the API
I've added a FilterForm with GoAndClear buttons to an AjaxFallbackDefaultDataTable. The filtering is working fine except for refreshing my table. I have a dropdown that changes the number of rows to show which does a target.addComponent(my AjaxFallbackDefaultDataTable) which doesn't reload the data but refreshes the. If I use this after I click a Go or Clear button then the table shows the proper rows, item count, and page links.
How can I handle Go and Clear clicks on my FilterForm to update my AjaxFallbackDefaultDataTable?
In the onsubmit method for the filter form just call .renderComponent() for the table.