Adding an aaData for default data src and a function based mDataProp gives a message
Adding an aaData for default data src and a function based mDataProp gives a message
Hi all,
I have a table wich is filled from a deeply nested object. I take the object's array field and pass to a function that will create the DataTable if it does'nt exist, then call fnAddData to add the array values to it. The problem is that I need a default added upon creation, wich I did with aaData and I also need some special formatting and the sorts applied upon the array's values before displaying the table. So I added a bunch of mDataProp functions to it. Now it gives off a warning about the functions. All the relevant external references are available to the functions (the table is properly displayed after all - it's just the warning alert that is disrupting the stuff).
Is there at least a way to disable the warning messages on a DataTable?
Here's the troubling piece:
[code]
"iDeferLoading": 5,
"aaData": [{id: "", numProcesso: "", titulo: "", assunto: "", descricao: "", acoesNecessarias: "", resp: {nome: ""}, situacao: "", prioridade: "", dtInicio: "", dtFim: ""}],
"aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "numProcesso" },
{ "mDataProp": "titulo" },
{ "mDataProp": "assunto" },
{ "mDataProp": "descricao"},
{ "mDataProp": "acoesNecessarias" },
{ "mDataProp": "resp.nome"},
{ "mDataProp": function(data, source, val){
try {
if(isNaN(data.situacao)) {
return data.situacao;
} else {
return sits[data.situacao-1];
}
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
if(isNaN(data.prioridade)) {
return data.prioridade;
} else {
return priors[data.prioridade-1];
}
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
return new Date(data.dtInicio).format('d/m/Y H:i:s');
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
return new Date(data.dtFim).format('d/m/Y H:i:s');
}
catch(err) {
return "";
}
}}],
[/code]
Any bits are appreciated.
Cheers!
Wellington
I have a table wich is filled from a deeply nested object. I take the object's array field and pass to a function that will create the DataTable if it does'nt exist, then call fnAddData to add the array values to it. The problem is that I need a default added upon creation, wich I did with aaData and I also need some special formatting and the sorts applied upon the array's values before displaying the table. So I added a bunch of mDataProp functions to it. Now it gives off a warning about the functions. All the relevant external references are available to the functions (the table is properly displayed after all - it's just the warning alert that is disrupting the stuff).
Is there at least a way to disable the warning messages on a DataTable?
Here's the troubling piece:
[code]
"iDeferLoading": 5,
"aaData": [{id: "", numProcesso: "", titulo: "", assunto: "", descricao: "", acoesNecessarias: "", resp: {nome: ""}, situacao: "", prioridade: "", dtInicio: "", dtFim: ""}],
"aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "numProcesso" },
{ "mDataProp": "titulo" },
{ "mDataProp": "assunto" },
{ "mDataProp": "descricao"},
{ "mDataProp": "acoesNecessarias" },
{ "mDataProp": "resp.nome"},
{ "mDataProp": function(data, source, val){
try {
if(isNaN(data.situacao)) {
return data.situacao;
} else {
return sits[data.situacao-1];
}
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
if(isNaN(data.prioridade)) {
return data.prioridade;
} else {
return priors[data.prioridade-1];
}
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
return new Date(data.dtInicio).format('d/m/Y H:i:s');
}
catch(err) {
return "";
}
}},
{ "mDataProp": function(data, source, val){
try {
return new Date(data.dtFim).format('d/m/Y H:i:s');
}
catch(err) {
return "";
}
}}],
[/code]
Any bits are appreciated.
Cheers!
Wellington
This discussion has been closed.