Resizing to small view shows URL from link in cell

Resizing to small view shows URL from link in cell

advineradviner Posts: 12Questions: 2Answers: 0

When creating the rows I format a cell like so:

{
data: 'VideoURL', title: '',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.VideoURL.length > 0) {
$(nTd).html("<a class='system-fonts text-normal blue' href='" + oData.VideoURL + "'>Video</a>");
}
}
}

and when viewing normally it looks fine as the first screenshot shows.
But when I resize it so that is in a mobile view. It shows the url from oData.VideoURL and not the word "Video" as the attached screenshot file ending in 1050.jpg shows

My code is the following:

var table = $('#clientVideoAgendaSummaryArchivedResults').DataTable({
select: true,
ordering: true,
paging: false,
searching: false,
data: [],
columnDefs: [
{ type: "time-date-sort", className: "dt-center", targets: [1] },
{ className: "dt-center", targets: [3] },
{ className: "dt-left", targets: [0] },
{ "width": "10%", "targets": [1, 2] },
{ "orderable": false, "targets": [3, 4, 5, 6] }
],
columns: [
{ data: 'EventTitle', title: 'Session' },
{ data: 'StartDate', title: 'Date' },
{ data: 'StartTime', title: 'Time' },
{ data: 'AgendaURL', title: '',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.AgendaURL.length > 0) {
$(nTd).html("<a class='system-fonts text-normal blue' href='" + oData.AgendaURL + "'>Agenda</a>");
}
}
},
{ data: 'ActionAgendaURL', title: '',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.ActionAgendaURL.length > 0) {
$(nTd).html("<a class='system-fonts text-normal blue' href='" + oData.ActionAgendaURL + "'>Action Agenda</a>");
}
}
},
{
data: 'MinutesURL', title: '',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.MinutesURL.length > 0) {
$(nTd).html("<a class='system-fonts text-normal blue' href='" + oData.MinutesURL + "'>Minutes</a>");
}
}
},
{
data: 'VideoURL', title: '',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.VideoURL.length > 0) {
$(nTd).html("<a class='system-fonts text-normal blue' href='" + oData.VideoURL + "'>Video</a>");
}
}
}

],
order: [[1, "desc"]],
responsive: true

}

Answers

  • advineradviner Posts: 12Questions: 2Answers: 0

    I changed fnCreateCell to render:

                        "render": function (oData, type, row, meta) {
                            if (row.URL.length > 0)
                                return "<a class='system-fonts text-normal blue' target='_blank' href='" + row.URL + "'>" + row.URLTitle + "</a>";
                            else
                                return '';
                        }
    

    it solved my issue

This discussion has been closed.