unable to create datatable from data revceived via ajax
unable to create datatable from data revceived via ajax
Him Allan/all,
Need urgent help!!
I m fetching data from backend using ajax call. But I m unable to create datatable.
html:
Id | Name | Status |
---|
js:
var oTable = $('#partnerTable').dataTable({
"sAjaxSource": 'displayPartner.action',
"dataType" : "json",
"aoColumns" : [{
"infos" : "partnerId"
}, {
"infos" : "partnerName"
}, {
"infos" : "status"
}]
});
data received:
{
"countryInfos":null,
"currencyInfos":[
],
"infos":[
{
"address":null,
"partnerId":"AIRTEL02",
"partnerName":"AIRTEL INDIA",
"password":null,
"phNo":null,
"status":"ACTIVE",
"thDtls":null,
"thresholdsDtls":null,
"username":null
},
{
"address":null,
"partnerId":"DOCOMO",
"partnerName":"DOCOMO",
"password":null,
"phNo":null,
"status":"ACTIVE",
"thDtls":null,
"thresholdsDtls":null,
"username":null
},
{
"address":null,
"partnerId":"INAir1406018829076",
"partnerName":"Airtel India",
"password":null,
"phNo":null,
"status":"ACTIVE",
"thDtls":null,
"thresholdsDtls":null,
"username":null
}
],
"obj":{
},
"recSinks":[
],
"sendSinks":[
],
"thresholdInfos":null
}
I am getting error:
TypeError: f is undefined
please help....
Please help me ...
This question has an accepted answers - jump to answer
Answers
I m using datatable1.10.4
Same pinch.. I too have similar problem,...
Please link to a test page showing the issue, as required in the forum rules. If urgent help is required, there is also priority support available.
Allan
In simple terms, if my received data is:
Using the above data, how to create a dataTables with three columns : Partner Id, Partner Name and Status.
Use the
ajax.dataSrc
option and set it to beinfos
. Then for each column usecolumns.data
and set it to bepartnerId
, etc.Allan
Thanks alot Allan, it resolved the issue. The dataTable is indeed one of the coolest js plugin.Feeling to explore it more. Grt work!!!:)