Hybrid View

  1. #1
    Ext User
    Join Date
    Jul 2010
    Posts
    24
    Vote Rating
    0
    uxdan is on a distinguished road

      0  

    Default Create Links for Twitter Example?

    Create Links for Twitter Example?


    I'm fairly new to the whole DataView / Store / Reader concepts, and I was wondering how you might go about converting the twitter example to activate the links within the tweets? Is there a built-in function per chance that would allow a tie in to easily modify a single piece of the json response?

    Thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    you can use JavaScripts own replace function:

    text.replace(/(http:\/\/)(.*)\s/gi, '<a href=$1$2>$1$2</a>')
    I think that will work, let me know if it doesn't
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext User
    Join Date
    Jul 2010
    Posts
    24
    Vote Rating
    0
    uxdan is on a distinguished road

      0  

    Default


    I guess I wasn't as clear... :-(

    I know how to replace it, but I just don't know where i can grab the text. So where would i put that code?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    a config option for DataView is prepareData which is not in the API Docs for Touch or ExtJS.

    Here is a sample that will take the data for each record in a store, get the value in the created key and format it to a date.

    Code:
    new Ext.DataView({
    	...
    	prepareData  : function(data) {
    		data.created = Ext.util.Format.date(new Date(data.created), "m-d-Y");
    		return data;
    	}
    })
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Ext User
    Join Date
    Jul 2010
    Posts
    24
    Vote Rating
    0
    uxdan is on a distinguished road

      0  

    Default


    that looks very promising, except i keep getting double output of what i decide to change. so if i do:

    Code:
    prepareData: function(data) {
     data.text = data.text + 'test';
     return data;
    }
    i will get my my string back with 'testtest' appended.

    Any ideas why it is doubled?

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    try

    Code:
    prepareData: function(data) {
       data.text = 'test';
       return data;
    }
    What you were doing was taking what was in data.text and adding 'test' to it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Similar Threads

  1. How do I create a a simple list of links?
    By kohalza in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 9 Aug 2012, 2:12 AM
  2. How to create links in templates?
    By Dumas in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 19 Jul 2010, 6:38 AM
  3. Replies: 0
    Last Post: 15 Jul 2009, 12:46 AM
  4. howto create a tabpanel with links dynamically
    By Mario Minati in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 21 Jul 2008, 7:42 AM
  5. How to create menu items like the "Quick Links" above?
    By pnfsjp in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 25 Sep 2007, 8:18 PM

Thread Participants: 3

Tags for this Thread