jQWidgets Forums

jQuery UI Widgets Forums Grid How to set cell background-image from rowData

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 3 months ago.

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

  • jacks
    Participant

    I’d like to use the cellsrenderer function to set the background-image css property to a value in a hidden field in the row data.
    I haven’t figured out how to find the cell element itself so I can use jquery to set it like: $(???).css(“background-image”, rowData[‘PicFile’] )

    … or should it be done in a cellclassname function:
    cellclassname: function (row, column, value, data) {
    }

    thanks!


    Peter Stoev
    Keymaster

    Hi jacks,

    With cellclassname, you can style a cell. Ex: http://jsfiddle.net/jqwidgets/Laapjb8z/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    jacks
    Participant

    Hi Peter, Yes, I know how to do that. What I’m asking is how to take an image filename that is a field in the row data and then use that image to set as the css background-image to that filename.

    Every cell will have a unique image.

    An analogy to the example that you provided would be if the color for each cell were provided in a rowData field – this is not possible to do with a single class because the color value changes with each cell. Within some function then I could do:
    $(currentcell).css(“background-color”, rowData[‘color’] )

    is something like this possible?


    Peter Stoev
    Keymaster

    Hi jacks,

    Implement cellsrenderer. It allows you to apply custom HTML and HTML Styles for each cell in a column i.e it won’t use predefined CSS Classes as the cellclassname does.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.