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
    604
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar