jquery - Frozen columns not aligned with scrollable columns -
basically, i've 2 columns.
left --> frozen columns
right --> scrollable columns
the code produces image frozen rows not aligned scrollable rows. rows of scrollable columns changes size based on inputs fed, applying css tricks doesn't work here. couldn't find regards primefaces fixed.
so option left apply jquery code fixed. somehow, code not producing expected results. me fixed?
for now, code prints following image:
xhtml.page
<ui:define name="content"> <h:form id="identityform"> <div> <p:panel> <!--ui repeat--> <h:panelgrid columns="2" columnclasses="padding-right-5,max_width_944" styleclass="margin_bottom_30"> <h:column> <p:outputpanel rendered="#{not empty identityform.halex}"> <table class="margin_top_27"> <tr> <th class="height_26"></th> </tr> <tr> <th class="header ui-state-default"> <h:outputtext value="#{msgs['hal.col.name']}" /> </th> </tr> <ui:repeat value="#{identityform.halex}" var="halex}" varstatus="halline"> <tr class="#{itemline.odd ? 'oddrow' : 'evenrow'}"> <td class="row-content height_54" style="width: 57px;"> <h:outputtext value="#{halex.shortcode}" /> </td> </tr> </ui:repeat> </table> </p:outputpanel> </h:column> <h:column> <div class="max_width_944 overflow-x"> <table id="free_columns"> <ui:repeat value="#{halexbean.selectedhalexitem}" var="hal"> <tr> <th class="header ui-state-default"> <h:outputtext value="#{msgs['hal.col.customer']}" /> </th> </tr> </ui:repeat> <ui:repeat value="#{halexbean.selectedtype}" var="lam" varstatus="status"> <tr class="#{status.odd?'oddrow':'evenrow'}"> <td class="row-content"> <h:outputtext value="#{parttype.name}"></h:outputtext> </td> <td class="row-content" style="min-width:150px;"> <h:outputtext value="#{parttype.age}"></h:outputtext> </td> <td class="row-content"> <h:outputtext value="#{parttype.address}" /> </td> </tr> </ui:repeat> </table> </div> </h:column> </h:panelgrid> </p:panel> </div> </h:form> </ui:define>
css.page
.padding-right-5 { padding-right: 5px; } .max_width_944 { max-width: 944px; } margin_top_27 { margin-top: 27px; } .row-content { min-width: 100px; min-height: 100px; vertical-align: middle; height: 50px; border: 1px solid; height: 57px; }
jquery code:
<script type="text/javascript"> $(document).ready(function() { $("#free_columns tr").each(function (index, element) { //get row height freecolumntable , corresponding row in table frozencolumns var rowoneheight = $(this).height(); var rowtwo = $(".row-content tr:eq(" + index + ")"); //if no matching row found in table two, stop loop if (!rowtwo.length) return false; var rowtwoheight = rowtwo.height(); //compare row heights, , set least high row height of highest 1 if (rowoneheight > rowtwoheight) { //set rowtwoheight rowoneheight rowtwo.height(rowoneheight); } else { $(this).height(rowtwoheight); } }); }); </script>
Comments
Post a Comment