Default Column Value
Default Column Value
I'm retrieving data back as an json object and putting it in the aaData parameter. The problem is sometimes in the data, there isn't a matching column, and it throws an error like:
[code]DataTables warning (table id = 'TablesDisplay'): Requested unknown parameter 'office_percentage_2' from the data source for row 0[/code]
Is there a way that I can set the default value for a column so that error messages does not appear?
BTW, I am setting up my columns like so in aoColumns:
[code]
[{
'sTitle' : 'Region',
"mDataProp" : "region"
}, {
'sTitle' : 'Total Vote Share {{#dataset1}}{{cycle}}{{/dataset1}}',
"mDataProp" : "office_1_percentage",
"sType" : "strip-number"
}, {
'sTitle' : 'Total Vote Share {{#dataset2}}{{cycle}}{{/dataset2}}',
"mDataProp" : "office_2_percentage",
"sType" : "strip-number"
}],
[/code]
[code]DataTables warning (table id = 'TablesDisplay'): Requested unknown parameter 'office_percentage_2' from the data source for row 0[/code]
Is there a way that I can set the default value for a column so that error messages does not appear?
BTW, I am setting up my columns like so in aoColumns:
[code]
[{
'sTitle' : 'Region',
"mDataProp" : "region"
}, {
'sTitle' : 'Total Vote Share {{#dataset1}}{{cycle}}{{/dataset1}}',
"mDataProp" : "office_1_percentage",
"sType" : "strip-number"
}, {
'sTitle' : 'Total Vote Share {{#dataset2}}{{cycle}}{{/dataset2}}',
"mDataProp" : "office_2_percentage",
"sType" : "strip-number"
}],
[/code]
This discussion has been closed.
Replies
Allan