server side loaded data with a column render
server side loaded data with a column render
I have a column defined with a render function
<th data-render="viewProject">Project #</th>
I've tried to get the function working to display make the id a link out based on the project number.
function viewProject(data, type, row, meta) {
return data;
}
(I've simplified it down as much as possible to rule out any problems in the function itself)
I'm getting
DataTables warning: table id=DataTables_Table_0 - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
I've looked here but I'm not really sure what's going on with this. https://datatables.net/manual/tech-notes/4
Quite a bit of that table has null values, but the first row isn't one of them. I made sure by explicitly filtering out all rows where that column is null to test.
I'm using a an ajax call that looks like
datatablesConfig.ajax = function (data, callback, settings) {
dwrFunction(JSON.stringify(data), function (json) {
try{
callback(JSON.parse(json))
} catch(err){alert("ERROR MESSAGE:" + err)}
})
}
I'm wondering if that is causing me a problem because the data is changing in a way that the code isn't expecting
This question has an accepted answers - jump to answer
Answers
looking at the "Parameter is an integer" case
there are no row or colspans in my code; I've tried botjh
and
and get the same warning in both cases
I don't use the columns or the columndef (I have a base html table and construct everything around it)
I'm not sure how to calculate #cells = #columns * #rows to check it
I think this thread is discussing what you are trying to do with the
data-render
attribute.https://datatables.net/forums/discussion/comment/82719/#Comment_82719
Kevin
These work.
looking at the thread you linked, the issue is me attempting to set a renderer via data-render is the issue.
I can't tell what it's actually expecting. It definitely shouldn't be throwing an error the way that it is.
it seems like it would be pretty trivial to
1. Check to get column.data("render")
2. check to see if typeof window[column.data("render")] == "function"
3. if so, set column.render = window[column.data("render")]
4. if not, check any other valid use of data-render as a string. as I mentioned, I'm not sure if there actually is any valid use of that parameter.
5. otherwise ignore the parameter