getting 'Requested unknown parameter' error when I trying to sorting
getting 'Requested unknown parameter' error when I trying to sorting
quick12
Posts: 1Questions: 1Answers: 0
I'm using Datatables.js with Laravel. I am getting data with serverside function of Datatables.js but when I try to sort on the 'price' column I get the following error.
Note: This discussion is my first. Sorry for code lines.
Requested unknown parameter 'null' for row 0, column 2.
Where am I missing?
<table id="ordersTable" class="table-striped table" >
<thead>
<tr>
<td>
<div class="iconFlex">
ORDER NUMBER
</div>
</td>
<td>STORE</td>
<td>STATUS DATE</td>
<td>PRODUCT</td>
<td>BUYER</td>
<td>Dimension/Weight</td>
<td>PRICE</td>
<td>STAT</td>
</tr>
</thead>
</table>
$(function () {
$("#ordersTable").DataTable({
"ordering": true,
columnDefs: [{
orderable: false,
targets: "no-sort"
}],
order: [[ 0, 'asc' ]],
processing: true,
serverSide: true,
ajax: "{{route('index')}}",
columns: [
{
data: 'price',
render: function (data, type)
{
if (type === 'display')
{
return '£'+data;
}
}
},
]
});
});
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
Answers
You have this:
The
columns.render
function always needs to return something. You aren't returning anything if thetype
is notdisplay
. This change should help.Kevin