[CLOSED] Icon column in GridPanel based on column from store

  1. #1

    [CLOSED] Icon column in GridPanel based on column from store

    Hi,

    I would like to have a column in my GridPanel that displays an icon based on a column from the store. For example, if I had a column in the store that had values like "image", "text", or "audio", I want to display a different icon for each of these. How would I do this?


    Thanks,
    Jeremy
  2. #2

    RE: [CLOSED] Icon column in GridPanel based on column from store

  3. #3

    RE: [CLOSED] Icon column in GridPanel based on column from store

    What would I use if I don't want to make a command? I just want this for display.
  4. #4

    RE: [CLOSED] Icon column in GridPanel based on column from store

    Hi,

    You don't need a command. As mentioned in the first item of the post (link from jchau)
    can
    be solved by using a <Renderer> and returning a string of html
    which includes an <img> tag. The src of the img should be the data
    item for that column.
    Please perform the following steps

    1. Add Renderer to the column
    <Renderer Fn="imageRenderer" />
    2. Define something following in the page
    function imageRenderer(value, metaData, record){
          var imageUrl = "default.png";
    
          switch(record.get('data_type')){ //'data_type' for example only, you have to use own field
                 case "video":
                      imageUrl = "video.png";
                      break;
                 case "audio":
    
                      imageUrl = "audio.png";
                      break;
          }
    
          return "<img src='"+ imageUrl + "'/>";
    }
  5. #5

    RE: [CLOSED] Icon column in GridPanel based on column from store

    Oh, right. I saw that. I should have been more clear, though. I would like to use one of the builtin icons for this column.
  6. #6

    RE: [CLOSED] Icon column in GridPanel based on column from store

    I think I figured it out. I just saw the "icons/foo-png/ext.axd" example.

Similar Threads

  1. Replies: 3
    Last Post: Nov 10, 2011, 3:10 PM
  2. Replies: 1
    Last Post: Nov 04, 2011, 8:51 AM
  3. [CLOSED] Set a Command Columns Icon based on a Column Value
    By sisa in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 15, 2011, 1:54 PM
  4. Replies: 2
    Last Post: Sep 01, 2010, 11:28 AM
  5. Replies: 2
    Last Post: Jun 01, 2009, 2:26 PM

Posting Permissions