How to apply wrap text style in JSF datatable?












12















I have a data table in my application, I fix the columns width as 200. If i print small line in datatable column means it prints correct format. If i print lengthy line in the datatable column means, it cant wrap it out. how can i wrap the text in data table column.



Problem Description
enter image description here










share|improve this question

























  • @alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

    – Kukeltje
    Nov 25 '15 at 10:23
















12















I have a data table in my application, I fix the columns width as 200. If i print small line in datatable column means it prints correct format. If i print lengthy line in the datatable column means, it cant wrap it out. how can i wrap the text in data table column.



Problem Description
enter image description here










share|improve this question

























  • @alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

    – Kukeltje
    Nov 25 '15 at 10:23














12












12








12


3






I have a data table in my application, I fix the columns width as 200. If i print small line in datatable column means it prints correct format. If i print lengthy line in the datatable column means, it cant wrap it out. how can i wrap the text in data table column.



Problem Description
enter image description here










share|improve this question
















I have a data table in my application, I fix the columns width as 200. If i print small line in datatable column means it prints correct format. If i print lengthy line in the datatable column means, it cant wrap it out. how can i wrap the text in data table column.



Problem Description
enter image description here







jsf datatable






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '15 at 10:06









alexander

62111228




62111228










asked Dec 10 '13 at 12:01









PS KumarPS Kumar

49431434




49431434













  • @alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

    – Kukeltje
    Nov 25 '15 at 10:23



















  • @alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

    – Kukeltje
    Nov 25 '15 at 10:23

















@alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

– Kukeltje
Nov 25 '15 at 10:23





@alexander: has nothing to do with jsf either then, and nothing with a datatable, all just 'table' then... so html and css. Why not added these tags. And the answer is explicitly about PrimeFaces, so the question was about a PrimeFaces datatable... imo bad editing of tags

– Kukeltje
Nov 25 '15 at 10:23












3 Answers
3






active

oldest

votes


















15














You can control word wrapping by CSS word-wrap property. Inside tables, this only requires the table-layout property to be set to fixed, so that columns with a fixed width don't auto-expand when their content is larger.



E.g.



.fixed-size {
table-layout: fixed;
word-wrap: break-word;
}


and



<p:dataTable ... styleClass="fixed-size">





share|improve this answer



















  • 1





    @BalusC...its working.Thank u for u r suggestion..

    – PS Kumar
    Dec 10 '13 at 12:50













  • @BalusC, is there a way not to brake a word while wrapping ?

    – SergeiK
    Sep 6 '17 at 12:30



















5














The below worked for me in Chrome not in IE



.preformatted {
white-space: pre-wrap;
word-break: break-all;
}



<p:column>
<h:outputText value="#{bean.txt}" styleClass="preformatted" />
</p:column>






share|improve this answer


























  • if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

    – Teela
    Feb 3 '17 at 10:10





















0














My sollution is to apply word-break style to column. Just like:



                <p:column id="accountsMaskColumn"
headerText="#{msg['mr.settings.headers.accountMask']}"
filterBy="#{item.accountMask}"
sortBy="#{item.accountMask}"
style="word-break: break-word">
<h:outputText value="#{item.accountMask}"/>
</p:column>


Hope someone find this useful






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20493979%2fhow-to-apply-wrap-text-style-in-jsf-datatable%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    15














    You can control word wrapping by CSS word-wrap property. Inside tables, this only requires the table-layout property to be set to fixed, so that columns with a fixed width don't auto-expand when their content is larger.



    E.g.



    .fixed-size {
    table-layout: fixed;
    word-wrap: break-word;
    }


    and



    <p:dataTable ... styleClass="fixed-size">





    share|improve this answer



















    • 1





      @BalusC...its working.Thank u for u r suggestion..

      – PS Kumar
      Dec 10 '13 at 12:50













    • @BalusC, is there a way not to brake a word while wrapping ?

      – SergeiK
      Sep 6 '17 at 12:30
















    15














    You can control word wrapping by CSS word-wrap property. Inside tables, this only requires the table-layout property to be set to fixed, so that columns with a fixed width don't auto-expand when their content is larger.



    E.g.



    .fixed-size {
    table-layout: fixed;
    word-wrap: break-word;
    }


    and



    <p:dataTable ... styleClass="fixed-size">





    share|improve this answer



















    • 1





      @BalusC...its working.Thank u for u r suggestion..

      – PS Kumar
      Dec 10 '13 at 12:50













    • @BalusC, is there a way not to brake a word while wrapping ?

      – SergeiK
      Sep 6 '17 at 12:30














    15












    15








    15







    You can control word wrapping by CSS word-wrap property. Inside tables, this only requires the table-layout property to be set to fixed, so that columns with a fixed width don't auto-expand when their content is larger.



    E.g.



    .fixed-size {
    table-layout: fixed;
    word-wrap: break-word;
    }


    and



    <p:dataTable ... styleClass="fixed-size">





    share|improve this answer













    You can control word wrapping by CSS word-wrap property. Inside tables, this only requires the table-layout property to be set to fixed, so that columns with a fixed width don't auto-expand when their content is larger.



    E.g.



    .fixed-size {
    table-layout: fixed;
    word-wrap: break-word;
    }


    and



    <p:dataTable ... styleClass="fixed-size">






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Dec 10 '13 at 12:18









    BalusCBalusC

    848k29831503221




    848k29831503221








    • 1





      @BalusC...its working.Thank u for u r suggestion..

      – PS Kumar
      Dec 10 '13 at 12:50













    • @BalusC, is there a way not to brake a word while wrapping ?

      – SergeiK
      Sep 6 '17 at 12:30














    • 1





      @BalusC...its working.Thank u for u r suggestion..

      – PS Kumar
      Dec 10 '13 at 12:50













    • @BalusC, is there a way not to brake a word while wrapping ?

      – SergeiK
      Sep 6 '17 at 12:30








    1




    1





    @BalusC...its working.Thank u for u r suggestion..

    – PS Kumar
    Dec 10 '13 at 12:50







    @BalusC...its working.Thank u for u r suggestion..

    – PS Kumar
    Dec 10 '13 at 12:50















    @BalusC, is there a way not to brake a word while wrapping ?

    – SergeiK
    Sep 6 '17 at 12:30





    @BalusC, is there a way not to brake a word while wrapping ?

    – SergeiK
    Sep 6 '17 at 12:30













    5














    The below worked for me in Chrome not in IE



    .preformatted {
    white-space: pre-wrap;
    word-break: break-all;
    }



    <p:column>
    <h:outputText value="#{bean.txt}" styleClass="preformatted" />
    </p:column>






    share|improve this answer


























    • if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

      – Teela
      Feb 3 '17 at 10:10


















    5














    The below worked for me in Chrome not in IE



    .preformatted {
    white-space: pre-wrap;
    word-break: break-all;
    }



    <p:column>
    <h:outputText value="#{bean.txt}" styleClass="preformatted" />
    </p:column>






    share|improve this answer


























    • if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

      – Teela
      Feb 3 '17 at 10:10
















    5












    5








    5







    The below worked for me in Chrome not in IE



    .preformatted {
    white-space: pre-wrap;
    word-break: break-all;
    }



    <p:column>
    <h:outputText value="#{bean.txt}" styleClass="preformatted" />
    </p:column>






    share|improve this answer















    The below worked for me in Chrome not in IE



    .preformatted {
    white-space: pre-wrap;
    word-break: break-all;
    }



    <p:column>
    <h:outputText value="#{bean.txt}" styleClass="preformatted" />
    </p:column>







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 3 '17 at 9:56

























    answered Sep 14 '16 at 12:24









    TeelaTeela

    86127




    86127













    • if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

      – Teela
      Feb 3 '17 at 10:10





















    • if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

      – Teela
      Feb 3 '17 at 10:10



















    if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

    – Teela
    Feb 3 '17 at 10:10







    if the above style is applied in column level i.e., '<p:column styleClass="preformatted">' then it works fine in both IE and Chrome

    – Teela
    Feb 3 '17 at 10:10













    0














    My sollution is to apply word-break style to column. Just like:



                    <p:column id="accountsMaskColumn"
    headerText="#{msg['mr.settings.headers.accountMask']}"
    filterBy="#{item.accountMask}"
    sortBy="#{item.accountMask}"
    style="word-break: break-word">
    <h:outputText value="#{item.accountMask}"/>
    </p:column>


    Hope someone find this useful






    share|improve this answer




























      0














      My sollution is to apply word-break style to column. Just like:



                      <p:column id="accountsMaskColumn"
      headerText="#{msg['mr.settings.headers.accountMask']}"
      filterBy="#{item.accountMask}"
      sortBy="#{item.accountMask}"
      style="word-break: break-word">
      <h:outputText value="#{item.accountMask}"/>
      </p:column>


      Hope someone find this useful






      share|improve this answer


























        0












        0








        0







        My sollution is to apply word-break style to column. Just like:



                        <p:column id="accountsMaskColumn"
        headerText="#{msg['mr.settings.headers.accountMask']}"
        filterBy="#{item.accountMask}"
        sortBy="#{item.accountMask}"
        style="word-break: break-word">
        <h:outputText value="#{item.accountMask}"/>
        </p:column>


        Hope someone find this useful






        share|improve this answer













        My sollution is to apply word-break style to column. Just like:



                        <p:column id="accountsMaskColumn"
        headerText="#{msg['mr.settings.headers.accountMask']}"
        filterBy="#{item.accountMask}"
        sortBy="#{item.accountMask}"
        style="word-break: break-word">
        <h:outputText value="#{item.accountMask}"/>
        </p:column>


        Hope someone find this useful







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 7:01









        BenderBender

        146211




        146211






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20493979%2fhow-to-apply-wrap-text-style-in-jsf-datatable%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen