Results 1 to 2 of 2

Thread: Jason data for Image URL

  1. #1

    Lightbulb Jason data for Image URL

    hi folks,

    //Jason
    var jSource = '{....,"image_file":"http://extjs.com/deploy/dev/examples/shared/screens/desktop.gif"},..

    Code:
    items: [{
                columnWidth: .3,
                border: false,
                items: {
                     xtype:'box',
                         anchor:'',
                         isFormField:true,
                         fieldLabel:'Image',                   
                         autoEl:{
                         tag:'div', children:[{
                             tag:'img',
                             qtip:'Tooltip on the image',
                             src:'image_file'
                                             }....
    img src is displayed as text 'image_file' not taking taking actual data value from jason to display image URL.

  2. #2

    Default You're setting it to a string

    It's displaying the string 'image_file' because that's what you've set as the source.

    Likewise, if you did the following:
    Code:
    src: 'go eat bananas'
    The img's source would read as src='go eat bananas'

    Unfortunately, you haven't posted enough code for anyone to see how you're trying to access your jSource variable. Also, it looks like jSource is a string--notice the leading and trailing quotes.
    No doubt it is supposed to be a javascript object. If so, notice the notation below.
    Code:
    var jSource = {
      image_file: 'http://extjs.com/deploy/dev/examples/shared/screens/desktop.gif'
    }
    Then you'd reference the jSource object's image_file property as:
    Code:
    tag:'img',
    qtip:'Tooltip on the image',
    src: jSource.image_file
    If you mean to have jSource as a string, as if you're constructing your json object manually, then read up on Ext.encode() & Ext.decode().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •