Combining data-data with render

Combining data-data with render

fischerfischer Posts: 10Questions: 6Answers: 0
edited July 2020 in Free community support

I tried to configure a render function via a data-* attribute.

<table class="table table-centered table-hover mb-0 dataTable no-footer"
                   id="model-table" style="table-layout:fixed">
                <thead>
                <tr class="header-row">
                    <th tabindex="0" class="sorting align-middle" rowspan="1" colspan="1"
                        data-data="owner">Auswahl
                    </th>
                    <th tabindex="0" data-data="model.modelName"
                        class="sorting align-middle" rowspan="1" colspan="1">Modell
                    </th>
                    <th tabindex="0" data-data="model.url" data-render="renderLink"
                        class="sorting align-middle" rowspan="1" colspan="1">URL
                    </th>
                </thead>
                <tbody>
                </tbody>
     </table>

The render function is defined thus:

function renderLink( data, type, row, meta ) {
   if(!data) return '';
   else return '<a href="'+data+'">'+data+'</a>';
}

This causes
DataTables warning: table id=model-table - Requested unknown parameter 'model.url' for row 0, column 2. For more information about this error, please see http://datatables.net/tn/4

Removing the data-render attribute shows that the data is present.
Setting a break point on renderLink shows the function is not called.
The function is otherwise available.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.