jQWidgets Forums

jQuery UI Widgets Forums Grid bind data from jqxGrid to jqxWindow as image path

This topic contains 6 replies, has 2 voices, and was last updated by  grmbl 12 years, 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • grmbl
    Member

    Hi,

    I want to make a popuwindow appear with data from a grid.
    This is what I have so far.
    Seems like I can only bind it to input fields?
    I would like to have non-editable labels for the field values and an image shown with a field value.
    How can I accomplish this?

    This is what I have so far:


    // imagecell value
    var imagecellrenderer = function (row, column, value) {
    return value;
    }

    // imagecell click
    var imagecellclick = function(row) {
    var offset = $(“#jqxgrid”).offset();
    $(“#popupWindow”).jqxWindow({ width: 300, height: 200, resizable: false, autoOpen: false, position: { x: parseInt(offset.left) + 60, y: parseInt(offset.top) + 60} });
    // get the clicked row’s data and initialize the input fields.
    var dataRecord = $(“#jqxgrid”).jqxGrid(‘getrowdata’, row);
    $(“#itemname”).val(dataRecord.ITPRDC);
    $(“#itemdesc”).val(dataRecord.ITDESC);
    $(“#itemdrawing”).val(‘img/aswpic/’ + dataRecord.ITDRAW + ‘.jpg’);
    // show the popup window.
    $(“#popupWindow”).jqxWindow(‘show’);
    }

    columns: [

    { text: ‘Item’, datafield: ‘ITPRDC’, columntype: ‘button’, cellsrenderer: imagecellrenderer, width: ‘8%’, buttonclick: imagecellclick },

    ],

    Any suggestions?

    url = http://goo.gl/sNWBa

    Kind regards,

    grmbl


    Peter Stoev
    Keymaster

    Hi grml.

    I didn’t understand your question. What do you mean by: “bind data from jqxGrid to jqxWindow as image path”?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    grmbl
    Member

    Hi Peter,

    What I mean is how can I place an image on the jqxWindow with the path used from the datarow value.
    As far as I can see you can only bind data to input fields on the jqxWindow..?

    Kind regards,

    grmbl


    Peter Stoev
    Keymaster

    Hi grmbl,

    jqxWindow’s content can be any HTML Element. So to display an image, I suppose you need to add “img” tag to the jqxWindow’s content and set the img tag’s src attribute to point to the location of your image.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    grmbl
    Member

    yes, but how can i bind img src=[itemdrawing] ? (see example above)


    Peter Stoev
    Keymaster

    Hi grmbl,

    If you have the image’s path, select the IMG tag from the window with jQuery and use the jQuery’s attr method to set the ‘src’ attribute.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    grmbl
    Member

    ok, I understand Peter, that’s the whole point in jquery, lol.
    I’m new to js, jq… 🙂

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.