Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    image size and TileGrid

    SmartClient Version: v13.1p_2025-12-31/AllModules Development Only (built 2025-12-31)

    Hi, I was trying to use the imageWidth and imageHeight properties on a field of a TileGrid, using the notation that allows setting a string representing the name of a field which, in the record, contains the actual size:

    Code:
    animalData = [
        {
            picture:"Elephant.jpg",
            imageWidth:150,
            imageHeight:113,
            commonName:"Elephant (African)",
            information:"The African Elephant is the largest of all land animals and also has the biggest brain of any land animal. Both males and females have ivory tusks. Elephants are also wonderful swimmers. Man is the only real enemy of the elephant. Man threatens the elephant by killing it for its tusks and by destroying its habitat.",
            lifeSpan:60,
            scientificName:"Loxodonta africana",
            diet:"Herbivore",
            status:"Threatened"
        }
    ];
    Code:
    isc.TileGrid.create({
        tileWidth:150,
        tileHeight:190,
        height:"100%",
        width:"100%",
        showAllRecords:true,
        data:animalData,
        fields: [
            {name:"picture", type:"image", imageURLPrefix:"../inlineExamples/tiles/images/", imageWidth:"imageWidth", imageHeight:"imageHeight"},
            {name:"commonName"},
            {name:"status"}
        ]
    });
    Unfortunately, I noticed that this does not work, since I cannot find the dimensions in the <img> tag, even though SimpleTile is based on a DetailViewer whose fields should support this behaviour.

    However, I then noticed that if I use numeric values directly for imageWidth and imageHeight, those values are correctly applied to the <img> tag:

    Code:
    isc.TileGrid.create({
        tileWidth:150,
        tileHeight:190,
        height:"100%",
        width:"100%",
        showAllRecords:true,
        data:animalData,
        fields: [
            {name:"picture", type:"image", imageURLPrefix:"../inlineExamples/tiles/images/", imageWidth:150, imageHeight:113},
            {name:"commonName"},
            {name:"status"}
        ]
    });
    I therefore wonder whether this is something that is supposed to work (and maybe I need a different setting), or whether it is not supported and I should instead customize the Tile.

    #2
    hi Claudio, thanks for the report.

    The problem here is that imageSize is also set, by default, but is not a string - we'll make a change to fix it, but you can work around it for the moment by just also setting imageSize to a string, like imageSize: "imageWidth". The actual value doesn't matter since, in this case, you are also providing imageWidth and imageHeight, so imageSize is only a fallback.

    We'll update here when a tweak has been made.

    Comment


      #3
      This one has been fixed for builds dated January 3 and later.

      Comment


        #4
        SmartClient Version: v13.1p_2026-01-04/Enterprise Deployment (built 2026-01-04)

        I see it's working now, thank you very much!

        Comment

        Working...
        X