function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student 

Why does my fixed headers script work on one page but not the other? jQuery

Hey there,

I have a visualforce page with different Jquery functions. One is for highlighting rows and the other is for fixing a header whilst scrolling. For some reason, when implimenting the code in bold, it prevents me from navigating between tabs and even if I remove two of the four scripts....it will still not fix the header like it does in the second example. please help

Tabbed VF page (navigation/fixed header, highlihgting not working)

<apex:page standardController="Office__c"  showHeader="true"
tabStyle="Office__c"  >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"/>
<apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css"/>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="{!URLFOR($Resource.jquery_vfFloatingHeaders)}"></script>


<script>
$j = jQuery.noConflict();
function highlightElem(elem){
$j(elem).parent().parent().parent().find('tr').removeClass('ui-state-highlight');
$j(elem).parent().parent().addClass('ui-state-highlight');
}
</script>

<style>
.activeTab {background-color: #892034; color:White;
background-image:none}
.inactiveTab { background-color: #00204E; color:white;
background-image:none}
</style>

<style>
input[name=newNote] {
    display: none;
}
input[name=attachFile] {
    display: none;
}
</style>

<style>
        .tableContainer
        {
            height:70px;
            width: 100%;
            overflow: auto;
        }      
        .floatingStyle
        {
            position:relative;
        }
    </style>
<script>
    $(document).ready(function() {
        $('.floatingHeaderTable').vfFloatingHeaders();
    });
    </script> 
  



<apex:tabPanel switchType="client" value="{!BLANKVALUE($CurrentPage.parameters.tab,'Offdetails')}"
id="OfficeTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">
<apex:tab label="Details" name="Offdetails" id="tabdetails" >
<apex:detail inlineEdit="True" relatedList="true" title="true"/>
</apex:tab>


<apex:tab label="Office Commissions" rendered="{!$ObjectType.Office_Commission__c.Accessible}" name="Office Commissions" id="tabOfficeCommissions" >
<apex:pageBlock title="Office Commissions" >
<apex:form >
<apex:outputPanel styleClass="tableContainer" layout="block">
<apex:pageBlockTable value="{!Office__c.Office_Commissions__r}" var="OffCom" styleclass="floatingHeaderTable">
<apex:column headerValue="Office Commissions" >
<apex:commandLink rerender="OffComdetails" oncomplete="highlightElem(this);"> {!OffCom.Name}
<apex:param name="OffComid" value="{!OffCom.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!OffCom.Upfront_Bonus_Average__c}"/>
<apex:column value="{!OffCom.Ongoing_Bonus_Average__c}"/>

<apex:column value="{!OffCom.Commission_Period_Start__c}"/>
<apex:column value="{!OffCom.Commission_Period_End__c}"/>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="OffComdetails">
<apex:detail subject="{!$CurrentPage.parameters.OffComid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>


Test VF page - fixed header working

<apex:page standardController="Office__c"  >

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="{!URLFOR($Resource.jquery_vfFloatingHeaders)}"></script>
   
<style>
        .tableContainer
        {
            height:70px;
            width: 100%;
            overflow: auto;
        }      
        .floatingStyle
        {
            position:relative;
        }
    </style>

    <script>
    $(document).ready(function() {
        $('.floatingHeaderTable').vfFloatingHeaders();
    });
    </script>  

<apex:pageBlock title="Office Commissions" >
<apex:form >
<apex:outputPanel styleClass="tableContainer" layout="block">
<apex:pageBlockTable value="{!Office__c.Office_Commissions__r}" var="OffCom" styleclass="floatingHeaderTable">
<apex:column headerValue="Office Commissions" >
<apex:commandLink rerender="OffComdetails" > {!OffCom.Name}
<apex:param name="OffComid" value="{!OffCom.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!OffCom.Upfront_Bonus_Average__c}"/>
<apex:column value="{!OffCom.Ongoing_Bonus_Average__c}"/>

<apex:column value="{!OffCom.Commission_Period_Start__c}"/>
<apex:column value="{!OffCom.Commission_Period_End__c}"/>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="OffComdetails">
<apex:detail subject="{!$CurrentPage.parameters.OffComid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>

</apex:page>

Andries.NeyensAndries.Neyens
Including 2 times the JQuery script is not a good idea! Leave out the 1.6.1 version.
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student
I have tried that but although you can navigate between the tabs, it still wont freeze the headers. Do i have to add something to the scripts to make them compatible with the tabpanel set up?
Andries.NeyensAndries.Neyens
I see that the JQuery script demo (http://xerointeractive-developer-edition.na9.force.com/partyForce/floatingHeaders) for this freezing of headers is using the following js files:


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
    <script src="/partyForce/resource/1362513043000/XeroInteractive__jquery_vfFloatingHeaders"></script>

I did not look into detail, but maybe you are missing some scripts ?

Best thing to do is to debug it in javascript and see if all function calls are known...
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student
But it works in a normal VF page, it only stops working shoul I add it to a VF page using a tabpanel. How would I go about debugging it?
RitikaBhrgvRitikaBhrgv
Hi Mikie,

I agree with Andries that including 2 scripts in one page is not a good idea. It usually causes conflicts amongst them and prevents the expected behavior.

Also, in this the issue could be caused by this statement : $j = jQuery.noConflict();

This changes the namespace for calling further jquery functions. And since you are calling vfFloatingHeaders functions later, it is expecting the namespace that you have defined. Remove this statement and see if it works.
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student
If i remove it I think it will prevent tab navigation altogether
Marcio FritschMarcio Fritsch
So, I realized that this feature isnot working anymore (
http://xerointeractive-developer-edition.na9.force.com/partyForce/floatingHeaders)
Do you guys have any idea about this?