You need to sign in to do that
Don't have an account?
Sorting table on header click using jquery ??
Script :
<script type="text/javascript">
$(document).ready(function()
{
j$("#recurring").tablesorter();
}
);
</script>
My table code ::
<apex:datatable columns="12" id="recurring" styleClass="table table-striped tablesorter"
value="{!filteredRecurringExpenses}" var="item" >
<div class="outline-body">
<apex:column colspan="2">
<apex:facet name="header">
<apex:outputPanel >
<apex:outputText value="{!$Label.Date}"/>
<apex:outputText styleClass="requiredStyle" value="*"/>
</apex:outputPanel>
</apex:facet>
<apex:inputText value="{!item.transactionDate}" />
</apex:column>
but my table is not getting sort according to header ??
does sorting work on facet header ???
> j$("#recurring").tablesorter();
With this call you might be expecting initialize sorting on the <apex:datatable>. But the Id on <apex:datatable> is always translated into a different Id when it is actually rendered on your browser. So in this case the table Id will not be exactly equal to "recurring". The Id will become a value that contains the word "recurring".
But dont worry, Visualforce provides us with a tool called $Component.
So in your case.... Your script should be something like below
If this still does not work, your <apex:datatable> may not be giving the exact HTML that your jquery plugin is expecting.
That must help.