2

Well Ive been developing a JSF interface, and using primefaces have managed to create two datatables which pull data from an SAP / oracle ondemand crm system. However all is not going so smooth, Im having trouble with the datatable in a number of area's.

  1. I cannot seem to assign command buttons with unique ID's if I add them within a column in the datatable (cant use rowindexvar as it cannot be used for processing). Basically I need to set two buttons insert & Update as invisible until a row is selected in the second datatable in which time the button for the related table in the above datatable is then enabled and becomes clickable.

  2. I cannot seem to get the highlight color of the rowselect to change its colour, it maintains a weird yellow indentation color, which isnt strong enough to really let the user know they have selected the row.

  3. When I zoom in on the datatable, the columns overflow out of the datatable, (due to the number of columns) and i really really cannot find a work around.

All of these problems ive searched extensively to no avail so Im hoping that some1 here maybe even "Cagatay Civici" can try help me in some regard, I would really really appreciate the help.

Heres my XHTML

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <p:themeSwitcher initialText="Change Skin"  buttonPreText="Skin: "/>   
        <title>Elpone Facelet</title>
        <style type="text/css"> 
            td{ font-family:sans-serif; font-size: 10px;}
            h{ font-family:sans-serif; font-size: 10px; font-weight: bold;}
            body{background-color: grey;}
            #bannerImage{width:100%; height:160px;}
            .ui-datatable .ui-state-highlight {
            background-color:#83AAB4;}
           #buttonPanel{visibility:hidden;} 



        </style>
    </h:head>
    <h:body >
        <div id="bannerContainer">
        <h:graphicImage id="bannerImage" alt="ban_eloma" url="/resources/Eloma_banner1.jpg"/> 
        </div>

      <h:form>
                <p:panel header="SAP Accounts" id="sapPanel">    

            <p:growl id="growl" showDetail="true" />            

            <p:dataTable style="width:101%;"
                scrollable="false"    
                rowIndexVar="rowID"   
                id="debTable"
                var="debitors" 
                value="#{tableBean.deblst}"  
                paginator="true"
                rows="8"
                selection="#{tableBean.selectedRec}"
                rowSelectListener="#{tableBean.onRowSelect}"   
                update="debAccTable"
                selectionMode="single"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                rowsPerPageTemplate="8,15,20"

                >



                <p:column>

                    <f:facet name="header">
                        <h:outputText value="Kunnr" />
                    </f:facet>
                    <h:outputText value="#{debitors.debitorPK.kunnr}"/>
                </p:column>   

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="SAP gelöscht"/>
                    </f:facet>
                    <h:outputText value="#{debitors.loevm}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Name1"/>
                    </f:facet>
                    <h:outputText value="#{debitors.name1}"/>
                </p:column>  

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Name2"/>
                    </f:facet>
                    <h:outputText value="#{debitors.name2}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Name3"/>
                    </f:facet>
                    <h:outputText value="#{debitors.name3}"/>
                </p:column> 

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_ort01}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.ort01}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_pstlz}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.pstlz}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_smtpaddr}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.smtpaddr}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_stras}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.stras}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_land1}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.land1.country}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_telf1}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.telf1}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebitorTitle_telfx}"/>
                    </f:facet>
                    <h:outputText value="#{debitors.telfx}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Hauptzielgruppe"/>
                    </f:facet>
                    <h:outputText value="#{debitors.brsch.maintarget}"/>
                </p:column>
                 <p:column >
                    <f:facet name="header">
                        <h:outputText value="Unterzielgruppe"/>
                    </f:facet>
                    <h:outputText value="#{debitors.brsch.subtarget}"/>
                </p:column>




                <p:column>
                    <h:panelGrid columns="2" styleClass="actions" id="buttonPanel">  

                      <p:commandButton id="insertbutton" update=":form:display" value="Insert" title="Insert"> 
                 </p:commandButton>  
                        <p:commandButton disabled="#{tableBean.isButtonDisabled}" id="var22" update=":form:display" value="Update" title="Update"> 
                 </p:commandButton>  
                    </h:panelGrid>  
                </p:column> 

            </p:dataTable>
</p:panel>  

          <div style="background-color:#D01C2E; width:100%; height:12px;"></div>

            <p:panel header="Related Accounts">    
                 <p:dataTable id="debAccTable"                
                var="debAcc" 
                rows="5"
                paginator="true"
                update="debTable"
                value="#{tableBean.debAcclst}"
                selection="#{tableBean.selectedAccRec}"
                rowSelectListener="#{tableBean.onDecAccSelect}"  
                selectionMode="single"          
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                rowsPerPageTemplate="3,5,10"
                 >                
        <p:column selectionMode="single">


            </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_id_row_id}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.id.row_id}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_accountname}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.accountname}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_streetaddress}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.streetaddress}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_odkundennummer}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.odkundennummer}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_plz}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.plz}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_city}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.city}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_name2}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.name2}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_name3}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.name3}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_hauptzielgruppe}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.hauptzielgruppe}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_unterzielgruppe}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.unterzielgruppe}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_email}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.email}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_tel}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.tel}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_saploeschen}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.saploeschen}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_fax}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.fax}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDebAccTitle_deb}"/>
                    </f:facet>
                    <h:outputText value="#{debAcc.deb}"/>
                </p:column>

            </p:dataTable> 
            </p:panel>
        </h:form>
    </h:body>
</html>

I dont think you will need the Tablebean as the logic behind everything is working fine its just display problems and XHTML properties. However if required i will provide. Also take note that in the XHTML im currently messing around with a lot of things so there may be some redundant stuff in there.

reggie morgan
  • 51
  • 1
  • 2
  • 11

1 Answers1

0

Which version of primefaces are you using?

1) I'm on PrimeFaces 3.0 at the moment and I am pretty sure that each table cell renders a unique ID. Elements inside table cells should therefore obtain unique IDs, too. I guess your problem is that you need to know the ID of the button in order to update its state. I guess the easiest way is to update the whole datatable component instead of updating the button. You might consider having a look at the Input and Output facets that have been added to datatables: http://www.primefaces.org/showcase/ui/datatableEditing.jsf

2) Seems to be a matter of CSS to me. Have you tried applying your own style to the CSS class ui-state-highlight? You can use tools like Firebug in order to find out, why your styles are not applied. Perhaps you need to make some rules !important.

3) I'm not sure what you mean by 'zooming in on the table'. But I guess applying your own CSS styles to the table might be way to work around your problem.

Good luck .-)

Tim Brückner
  • 1,928
  • 2
  • 16
  • 27