1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    3
    Vote Rating
    0
    johndodge4 is on a distinguished road

      0  

    Default Unanswered: Getting original text from Ext.util.Format.ellipsis()

    Unanswered: Getting original text from Ext.util.Format.ellipsis()


    Hello.

    I'm trying to create a Show All Text / Shorten Text button in my Sencha Touch app that, when "Shorten Text" is clicked shortens the text on screen. Then, when clicked a second time, the button will read "Show All Text" and all the text that was shortened will be displayed again.

    I can get the shorten part to work just fine using Ext.util.Format.ellipsis(), but I can't get my original text back. Consider the following example:

    Code:
    if (btn.getText() === "Show All Text") {            
        for (var i=0, max=ratingDesc.elements.length; i < max; i++) {
            if (ratingDesc.elements[i].dom.childNodes[0]) {
                ratingDesc.elements[i].dom.childNodes[0].data = ratingDesc.elements[i].dom.childNodes[0].data;
            }
        }
        this.getShowAllTextBtn().setText("Shorten Text");    
    } else {
        for (var i=0, max=ratingDesc.elements.length; i < max; i++) {
            if (ratingDesc.elements[i].dom.childNodes[0]) {
                ratingDesc.elements[i].dom.childNodes[0].data = Ext.util.Format.ellipsis(ratingDesc.elements[i].dom.childNodes[0].data, 25, true);
            }
        }
        this.getShowAllTextBtn().setText("Show All Text");    
    }
    Thanks in advance.

  2. #2
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    606
    Answers
    66
    Vote Rating
    26
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    You could do some dirty stuff like tipsy, and store the original text in some native or custom attribute, like title or original-title, and display the full text or the ellipsis one on your will.
    Latest thoughts on the subject: http://joy2share.com/senchatouch/

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi