locked
HTML icons in Table row fields RRS feed

  • Question

  • Hi,

    how do i insert an icon into a table field?

    Tried everything i can find but nothing helps..

    contentItem.dataBind("value", function (value) {
             if (value) {
                if (value === 3) {
                    $(element).closest("td").css("background-image", "url(Images/Add-New.png)");
                      }
            }
        });

    Tuesday, June 17, 2014 2:08 PM

Answers

  • Solution for the alignment:

     $(element).closest("td").css("background-position", "center");

    • Marked as answer by Pratura Monday, June 23, 2014 10:17 AM
    Monday, June 23, 2014 10:17 AM
  • Solution:

     $(element).closest("td").css("background-image", "url('Content/Images/Check.png')").css("background-repeat", "no-repeat");

    But now i can't center the image horizontaly and verticaly.

    This doesen't seem to be working

     $(element).closest("td").css("display", "table-cell").css("vertical-align", "middle").css("text-align", "center");

    • Marked as answer by Pratura Monday, June 23, 2014 10:17 AM
    Wednesday, June 18, 2014 9:44 AM

All replies

  • Solution:

     $(element).closest("td").css("background-image", "url('Content/Images/Check.png')").css("background-repeat", "no-repeat");

    But now i can't center the image horizontaly and verticaly.

    This doesen't seem to be working

     $(element).closest("td").css("display", "table-cell").css("vertical-align", "middle").css("text-align", "center");

    • Marked as answer by Pratura Monday, June 23, 2014 10:17 AM
    Wednesday, June 18, 2014 9:44 AM
  • Solution for the alignment:

     $(element).closest("td").css("background-position", "center");

    • Marked as answer by Pratura Monday, June 23, 2014 10:17 AM
    Monday, June 23, 2014 10:17 AM