Smart Table event beforeRebindTable calling only when view loads in SAP UI5 - sapui5

I am facing issue with the smart table event beforeRebindTable here iam having a smart table in view2 based on some selection on view1 we need to navigate to view2 and bind data to the smart table where iam writing my code in beforeRebindTable event, for the first time it is working fine, but when we navigate to view1 and again selecting some value in view1 and navigate to view2 then beforeRebindTable event is not triggering.
Please suggest.

After navigating to the 2nd page, you should call #rebindTable method in order to trigger that event.
If you are using sap.ui.core.routing class for navigation, then you can do it in 'routePatternMatched' event.

Related

Updating Modal with controller model

I am trying to use dynamic content inside my modal using angular controller model.
My codepen: codepen.io/anon/pen/dpJxa1
I am trying to increment $scope.count whenever user clicks Create contact button inside the modal. This count will be used to populate first name in the modal.
Even though the count is increasing which is shown in alert, it is not reflecting the modal. How can I listen for the changes in my model and show it in modal.
Thanks in advance.
Call the .show() method on your modal again, after each time you want the modal to update content. So add something like $scope.myModal.show(); to your increment function.

Moving table view cells from one view controller to another

I am new to stack overflow and a student currently learning objective-C at university. I am building an APP for the science museum in London and I'm creating an events planner.
I have two table views set up in two different View Controllers.
The first View controller and table view is called "Events" and it holds all of the current days events. When you click on an event, it goes into a new View Controller, gives more information about the event and has a button to "Add To Events", which pops up an alert saying: "Are you sure you want to add this to your events?" with an add button and dismiss button accordingly.
The information in this table view is populated using three NSMutableArray's. (One for title, subtitle and image).
The second view controller has an empty table view inside it. I am trying to make it so whenever a user finds an event they like, they can click into it, see more info and if they want to add it to their own events page, they can. I have got the "Add" button of the alert responding using an NSLog message, so the code to implement the adding to events would go there.
My question is, if i click on the first event, and then choose to add it to my events, how do i send the information of that specific tableviewcell that i clicked to display in the second view controllers table view ?
I have looked all over the place for information regarding this and have taken an abundance of Lynda courses online about IOS and objective-C, but I haven't been able to figure it all out.
Can anybody help?
First of all you shouldn't use three NSMutableArray's to populate your cells. Create one NSMutableArray and populate it with NSDictionarys with a key for the title, the subtitle and the image. Or even better: create a custom model (subclass of NSObject) for your Events and populate the NSMutableArray with those.
Now just like your NSMutableArray is the data source for your first table view controller you need another NSMutableArray as the data source for the second table view controller. When a user now clicks on "Add To Events" all you have to do is add the Event (Model or Dictionary) to the NSMutableArray of the second table view controller and either call - (void)reloadData on your table view so that it reloads ALL data or use the "Inserting, Deleting, and Moving Rows and Sections" methods from the UITableView Class Reference. This would be the better approach because it does not reload data that does not need to be reloaded.

Split View Controller Data parsing on the iPad

I have following codition for my app as shown in image.
On left View : The different User selection will be done in table view.
And the selected users information will be needed on right view while pressing the button.
How can I do this ?
Use of Protocol is very simple to solve your problem.
When you tap on row on left side, then you just need to pass the object as userinfo and make a call to its delegate method which will be implemented in rightview.
This is very simple task if you know how to implement protocols for the viewController.
Hope this helps you.
Use a delegate pattern.
When a row is selected from the table view in the left view, call the delegate to notify the selection. Afterward your delegate (which suppose to be the right view's controller) can display the corresponding user info.

Add Up/Down buttons to UITableView navigation bar

Many apps, including Apple's own native Mail.app on the iPhone implement an Up/Down button in the detail view which allows for quick and easy browsing. I wish to create such an interface in my own app, but am struggling to do so. So far I've setup a segmented control which links to an action in my navigation bar, but I'm struggling with what to put in the action to make the detail view for the table update when the user presses the "Up" button or "Down" button to navigate to the item before or after the current one.
Any help would be appreciated. Thanks.
It depends on how you have your data set up, but why can't you hook into your existing code? What are you doing in your existing code to refresh the detail view when a user selects a row in master view table? Can't you just call that method directly?
It's hard to give specific advice without more detailed information on your current design.

UINavigationController reloading UITableView

In my application I am parsing XML to create a UITableView. When a user selects a row it changes the file that it is parsing and reloads the UITableView.
I want to create a back button so that the user can go back the the previous XML page they were viewing.
In short how can I tell the navigation controller to create a back arrow for this page when all i am doing is reloading my UITableView?
I'd strongly suggest building another controller (i.e. UITableViewController) and push that instead of just reloading the table. This makes the button automagically, and (major plus here), it animates the whole digging down / stepping back in a way that the user is expecting it.
As a side note, I didn't manage to get a back-style button once I tried it, just a plain normal button (make a new button and set it at the navigation bar).
What you're describing is a navigation. Rather than reloading the table's data, simply push a new view controller onto the navigation stack every time a row is tapped. This is a fundamental pattern in iPhone development. Here is Apple sample code for a multi-level drill down table view.