Use a button to navigate to a different tab - uitabbarcontroller

My app has four tabs. The root view controller of the first tab (index zero) is where the log in page pops up as a modalviewcontroller, but a view controller in the fourth tab (index three) is where the log out button is. Is there a way to programmatically set it so that when the logout button is pushed the app transitions to the tab at index zero? I initially tried a push transition, but that made the root view controller of index zero instead show up as a view controller in index three.

If you want to programmatically change the tab, just call
[self.tabBarController setSelectedIndex:index];
In your case create the selector, which will be assigned to the logout button event.
- (IBAction) didClickLogoutButton:(id)sender {
// do some work to log out the user...
[self.tabBarController setSelectedIndex:0];
}
Hope this is what you meant.

Related

APEX - double click on interactive gird

Below is my interactive grid. It shows data from v$sql_monitor view based on sql_id from list .
What I would like to do is to create double-click dynamic action on a record. This action would open new modal dialog and pass two parameters : 1. sql_id from list above 2.sql_exec_id from clicked record. Would you give me a few hints how to do it ? I guess a piece of Javascript code will be necessary :(
There are multiple options to do this - here is one way, by using javascript custom events. I created a sample with an IG on the EMP/DEPT sample dataset with page 88 as IG and page 90 as modal. The column ENAME is a link to page 90 that sets a column value and a page item in the link.
Page 88 has an IG and 2 page items:
P88_PAGE_ITEM (a value entered on the page like the list in your screenshot)
P88_ENAME (to hold the selected report column value
Page 90 has 2 page items: P90_PAGE_ITEM and P90_REPORT_COLUMN
Create IG on page 90 on table EMP
On column ENAME, add the following under "JavaScript Initialization Code"
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '<button type="button" class="t-Button t-Button--link my-ename-js" data-ename="&ENAME.">&ENAME.</button>'
};
return config;
}
This is a button of type "display as link", created with the universal theme button builder that has 2 extra attributes: a class my-ename-js and a data attribute "ename" data-ename="&ENAME."
Create a dynamic action to capture the click and set the page item:
Make sure to set the scope to "Dynamic". This is needed because the event listener needs to be added again after a dom change (a search or filter of the IG).
add a true action of type "Set Value" to set the value of P88_ENAME to the value of the selected row
add a second true action to trigger a custom javascript event:
Create a dynamic action of type "Event: Custom" to capture the custom event triggered in the previous DA.
add a true action of type "Submit Page". Note that "Show Processing" needs to be unchecked.
Almost there. One last thing is to create a branch to the modal page:
Create a branch (process point "After Processing") with server-side condition of "Request = Value" with value OPENMODAL and link attributes below:
And this should be the result:
Well, I modified a bit your scenario.
I added new SelectList P88_FILTER
and added dynamic action ON_CHANGE :
with action
I modified source if IG:
These changes allowes me to filter IG . In our case filter returns always only one record like below.
and now my problem begins. In your scenario clicking the link "ename" updates field P88_ENAME and opens modal dialog with proper values. After my modification neither P88_ENAME updates nor modal dialog opens :(

how to redirect another page with select list value on button click in oracle apex?

i have select list values.after any change in select list and click on Button (it have to redirect the page number i have mentioned with select list value changed).
what i have done so far.
take another item P213_CLASS_TYPE_VAL
create DA on select list
Select :P213_CLASS_TYPE into :P213_CLASS_TYPE_VAL from dual;
item to submit : P213_CLASS_TYPE,P213_CLASS_TYPE_VAL
item to return : P213_CLASS_TYPE_VAL;
Button Action: Redirect to Page in this Application
Page 218
Set Item
Name Value
P218_GET_CLASS_TYPE &P213_CLASS_TYPE_VAL.
the issue we face is, some it redirect with changed item value and some time redirect with previous item value
You don't need a dynamic action to redirect to another page, that is a common mistake and unnecessarily complicates things.
The easiest way to do this is to have the button submit the page and create a branch to page 218 where you pass the value of P213_CLASS_TYPE_VAL.
On page 213: Button with action: "Submit Page"
On page 213:
Branch to page 218 with:
Server-side condition: "When Button Pressed" = your button.
Behavior: Page or URL(Redirect), page 281 and Set Items P218_GET_CLASS_TYPE to &P213_CLASS_TYPE_VAL.
That's all there is to it.

Shinyjs: On click option in shiny dashboard

I have a shiny dashboard app with 3 tabs and a notification menu. I am trying to track user activity on the dashboard and wish to log each of their clicks on the dashboard.
The code in server.R for the tabset panel is as below:
output$tabs1=renderUI(
tabsetPanel(type="tab",
tabPanel(id="OverallTab","Overall Activity"),
tabPanel(id="Tab1","Tab 1 details"),
tabPanel(id="Tab2","Tab 2 details"))
Part of my notification code is as below:
output$notiMenu <- renderMenu({
all_nots <- apply(u_notd, 1, function(row) {
notificationItem(text = row[["notification"]], icon("users"))
})
dropdownMenu(type = "notifications", .list = all_nots)
})
I am trying to use shinyjs to write to a dataframe if a user clicks on either of the tabs or notification menu as below:
tab1_clicled=""
tab2_clicked=""
noti_clicked=""
shinyjs::onclick("notiMenu",print("Notification clicked"),noti_clicked="YES")
shinyjs::onclick("Tab1",print("Tab1 clicked"),tab1_clicled="YES")
shinyjs::onclick("Tab2", print("Tab2 clicked"),tab2_clicled="YES")
df=as.data.frame(tab1_clicked,tab2_clicked,noti_clicked)
I face 2 issues here,
1) the on click option doesn't appear to work for the tab panels, using the shinyjs reference(here), I see that there is only a mention of using on click for the tabset panel and not for each tab panel?
2) I'm unable to modify the value of tab1_clicked inside the onclick function. It throws an error saying: Unhandled error in observer: unused argument (tab1_clicled = "YES")
Appreciate any help.
I just quickly skimmed your code and I can see two errors. The first parameter of onclick is the ID of the element. In your case, you want the ID of the actual tab button, but unfortunately the way tabs work in shiny, "Tab1" is actually the ID of the container of the tab panel but it's not the id of the tab button itself. Look at the HTML of a shiny app and you'll see that. Tabs are a bit weird and annoying and it's really difficult to deal with the tab buttons themselves in shiny.
Secondly, The second argument of onclick is the expression, but you're trying to run two expressions print("Tab1 clicked") and tab1_clicled="YES". You need to wrap these in {} so that it's considered one expression, like this:
onclick(id, {print("Tab1 clicked"); tab1_clicled="YES"}
But unfortunately getting the id of the tab button is difficult so I don't think onclick will be useful for that

How to toggle visibility action bar tab navigation?

I use Action Bar Sherlock library.
In SherlockFragmentActivity, Make tabs and pager (Swipe + Tab)
actionBar.addTab(actionBar.newTab().setText("tab1").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab2").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab3").setTabListener(this));
When paging. I change tab.
When tab selected, I change page.
(These works fine.)
And make button to toggle visiblity.
actionBar.setNavigationMode(NAVIGATION_MODE_TABS); // this force tab index = 0
//or
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
But Setting navigation mode to NAVIGATION_MODE_TABS,
make tab index = 0 not current tab(pager) index
Try storing current tab index to an integer before you call actionBar.setNavigationMode(NAVIGATION_MODE_TABS);
int index=actionBar.getSelectedNavigationItem();
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setSelectedNavigationItem(index);

Oracle APEX: Hide a button with dynamic actions

I'm tying to hide a button when a checkbox is deselected and show the button when selected. But I don't know why isn't it working because I have two date item and they are working fine.
When checkbox not selected
When checkbox selected
http://apex.oracle.com/pls/apex/f?p=17236:555 Workspace:
MACWADU_ORACLE Username: USER Password: 123qweASD
If someone wants to help me, can go to the application page 555 or explain here what I have to do.
Tanks
Your dynamic action tries to hide the button using the DOM Selector "APPLY_CHANGES", but this isn't actually the button's ID (it didn't have an ID at all).
Two changes required (I have made them):
1) Change the Button template to allow button attributes to be added:
<button value="#LABEL#" onclick="#LINK#" class="button-gray" type="button"
#BUTTON_ATTRIBUTES#>
<span>#LABEL#</span>
</button>
2) Change the button itself and set the Button Attributes property to:
id="APPLY_CHANGES"