Combining data-data with render

Combining data-data with render

fischerfischer Posts: 8Questions: 5Answers: 0
edited July 1 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">
                <tr class="header-row">
                    <th tabindex="0" class="sorting align-middle" rowspan="1" colspan="1"
                    <th tabindex="0" data-data="model.modelName"
                        class="sorting align-middle" rowspan="1" colspan="1">Modell
                    <th tabindex="0" data-data="model.url" data-render="renderLink"
                        class="sorting align-middle" rowspan="1" colspan="1">URL

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

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


Sign In or Register to comment.