I'm using dataTables to make table for my json data. I recieve data from server and that is like:
var BillingDate = [
{"branchcode":"668",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.649717",
"LastY":"52.488193",
"flag":"1",
"flag_Title":null
},
{
"branchcode":"669",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.712585",
"LastY":"52.935543",
"flag":"1",
"flag_Title":null
},
{"branchcode":"668",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.649717",
"LastY":"52.488193",
"flag":"1",
"flag_Title":null
},
{
"branchcode":"669",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.712585",
"LastY":"52.935543",
"flag":"1",
"flag_Title":null
},
{"branchcode":"668",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.649717",
"LastY":"52.488193",
"flag":"1",
"flag_Title":null
},
{
"branchcode":"669",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.712585",
"LastY":"52.935543",
"flag":"1",
"flag_Title":null
},
{"branchcode":"668",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.649717",
"LastY":"52.488193",
"flag":"1",
"flag_Title":null
},
{
"branchcode":"669",
"saleyear":"99",
"saleprd":"3",
"LastX":"36.712585",
"LastY":"52.935543",
"flag":"1",
"flag_Title":null
}
];
and my table code is like:
function CreateTablePagination(ID,data) {
$(ID).DataTable( {
data: data,
columns: [
{ "title": "branchcode" },
{ "title": "year" },
{ "title": "period" },
{ "title": "LastX" },
{ "title": "LastY" },
{ "title": "flag" }
]
} );
}
I've tried debugger and console.log. both showed my data clearly, but there is no data in table because of thr error.
the div container where my code is there is like:
<div class="ChartDiv">
<table id="OMID_DetailTable" class="display" width="100%"></table>
<div id="chartdiv">
</div>
</div>
but I keep recieving error for :
DataTables warning: table id={id} - Requested unknown parameter '{parameter}' for row {row-index}, column{column-index}`
does anyone know why? and the solution?