Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. <apex:page id="Registration" showHeader="false" controller="SolutionLibraryTabController" title="Solution Library" standardStylesheets="false">
  2. <style>
  3. .activeTab {background-color: #236FBD; color:white; background-image:none}
  4. .inactiveTab { background-color: lightgrey; color:black; background-image:none}
  5. </style>
  6. <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab" value="{!var}" >
  7. <apex:tab label="Search" name="srch" id="srch" onclick="setActiveTab('srch')">
  8. <apex:include pageName="SolutionLibrarySearch"/>
  9. </apex:tab>
  10. <apex:tab label="Insert" name="insrt" id="insrt" onclick="setActiveTab('insrt')">
  11. <apex:include pageName="SolutionLibraryInsert"/>
  12. </apex:tab>
  13. </apex:tabPanel>
  14. <apex:form>
  15. <apex:actionFunction name='setActiveTab' action='{!setActiveTab}' reRender="none">
  16. <apex:param id='tabname' assignTo="{!var}" value=""/>
  17. </apex:actionFunction>
  18. </apex:form>
  19. </apex:page>
  20.  
  21. public class SolutionLibraryTabController {
  22. /*Tab var*/
  23. public String var{get;set;}
  24.  
  25. public SolutionLibraryTabController(){
  26. var = 'srch';
  27. }
  28.  
  29. public PageReference setActiveTab() {
  30. if(var=='srch'){
  31. var='insrt';
  32. }
  33. else {
  34. var = 'srch';
  35. }
  36. return null;
  37. }
  38. }
  39.  
  40. <apex:page id="Registration" showHeader="false" controller="SolutionLibraryTabController" title="Solution Library" standardStylesheets="false">
  41. <style>
  42. .activeTab {background-color: #236FBD; color:white; background-image:none}
  43. .inactiveTab { background-color: lightgrey; color:black; background-image:none}
  44. </style>
  45. <apex:tabPanel tabClass="activeTab" id="tabpanelId" inactiveTabClass="inactiveTab" value="{!var}" selectedTab="{!var}">
  46. <apex:tab label="Search" name="srch" id="srch" onclick="setActiveTab('srch')">
  47. <apex:include pageName="SolutionLibrarySearch"/>
  48. </apex:tab>
  49. <apex:tab label="Insert" name="insrt" id="insrt" onclick="setActiveTab('insrt')">
  50. <apex:include pageName="SolutionLibraryInsert"/>
  51. </apex:tab>
  52. </apex:tabPanel>
  53. <apex:form >
  54. <apex:actionFunction name="setActiveTab" action="{!setActiveTab}" reRender="tabpanelId,values">
  55. <apex:param id="tabname" assignTo="{!var}" value=""/>
  56. </apex:actionFunction>
  57.  
  58. <apex:outputPanel id="values">
  59. <apex:outputText value="{!var}" label="You have selected:" />
  60. </apex:outputPanel>
  61. </apex:form>
  62. </apex:page>
  63.  
  64. <apex:page id="Registration" showHeader="false" controller="SolutionLibraryTabController" title="Solution Library" standardStylesheets="false">
  65.  
  66. <style>
  67. .activeTab {background-color: #236FBD; color:white; background-image:none}
  68. .inactiveTab { background-color: lightgrey; color:black; background-image:none}
  69. </style>
  70.  
  71. <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab" value="{!var}" >
  72. <apex:tab label="Search" name="srch" id="srch" ontableave="setActiveTab();" >
  73. <apex:include pageName="SolutionLibrarySearch"/>
  74. </apex:tab>
  75. <apex:tab label="Insert" name="insrt" id="insrt" ontableave="setActiveTab();" >
  76. <apex:include pageName="SolutionLibraryInsert"/>
  77. </apex:tab>
  78. </apex:tabPanel>
  79.  
  80. <apex:form >
  81. <apex:actionFunction name="setActiveTab" action="{!setActiveTab}" reRender="none" />
  82. </apex:form>
  83.  
  84. </apex:page>
  85.  
  86. public class SolutionLibraryTabController {
  87. /*Tab var*/
  88. public String var{get;set;}
  89.  
  90. public SolutionLibraryTabController(){
  91. var = 'srch';
  92. }
  93.  
  94. public PageReference setActiveTab() {
  95. if(var=='srch'){
  96. var='insrt';
  97. }
  98. else {
  99. var = 'srch';
  100. }
  101. System.debug('var '+var);//Use debug to check if value is there
  102. return null;
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement