How to get image from json response in webix

Hi Webix team

How to get image from json response in webix

Thank's in advance.

plzz mentioned the below sample code

{view:"label" "template":"image"}

Regards
Deepak

Comments

  • get dataurl from response and set it to img src https://en.wikipedia.org/wiki/Data_URI_scheme

  • Hi,

    My concern here is, I am able to iterate the VALUE from the JSON response for the text fields but not able to set the "src" value of the image part of template in toolbar.
    Please find the below code snippet for the clear picture:

    view: "toolbar",
    elements: [
    {view:"label",id:"TITLE"},{},
    {view:"label",id:"INSTANCENAME"},
    {view:"label",id:"NOTIFICATION"},
    {view:"label",id:"DATETIME", template:Date()},
    {view:"label","template":"image",align:"right", name:"I"}
    ],
    ///////////////////
    webix.ajax("data/data2.json", function(text){
    var headerInfo = webix.DataDriver.json.toObject(text);
    var i = 0,
    len = headerInfo.ROOT.HEADER[0].I.length,
    topBarItems = headerInfo.ROOT.HEADER[0].I;
    for (;i<len;i++){
    var cntrl = topBarItems[i].ID;
    if(topBarItems[i].HIDDEN == "FALSE")
    if (cntrl != 'DATETIME' && $$(cntrl))
    $$(cntrl).setValue(topBarItems[i].VALUE);
    }
    },this);

    JSON RESPONSE:

    {
    "HIDDEN": "FALSE",
    "ID": "LOGO",
    "LINKTYPE": "ABSOLUTE",
    "ONCLICK": "TRUE",
    "TOOLTIP": "lang.PC_LOGO_TOOLTIP",
    "URL": "filepath.POINTCROSS",
    "VALUE": "resources\Images\pbo.jpg"
    }

    please let me know if this is not clear,

    Regards,
    Deepak

  • up to me, you need to implement a custom label UI like that https://webix.com/snippet/40e1c6fa

  • Hi intregal

    i got solution about that.

    Thank you so much

    Regards
    Deepak

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!