What's a good way to handle ajax rows with mixed sets of columns?
What's a good way to handle ajax rows with mixed sets of columns?
greendeveloper
Posts: 4Questions: 0Answers: 0
Howdy. I'm using the plugin to display results of search queries from a database. I'm running into the issue where the database has a large range of "objects" defined and they don't all have the same sets of parameters. Thus, some rows will have all the columns I'm pulling properties from, some will have only a few and some might not have any. Is there a way I can use the mData property to silently drop null values in when properties aren't defined?
Here's an example of the type of data I'm trying to combine:
[code]
JSON: {
"dataset": [ {
"Col1": "Row1",
"Col3": true
}, {
"Col1": "Row2",
"Col2": "Data"
} ]
}
Table:
+------+------+------+
| Col1 | Col2 | Col3 |
+------+------+------+
| Row1 | | true |
| Row2 | Data | |
+------+------+------+
[/code]
Can the plugin handle this type of setup?
Here's an example of the type of data I'm trying to combine:
[code]
JSON: {
"dataset": [ {
"Col1": "Row1",
"Col3": true
}, {
"Col1": "Row2",
"Col2": "Data"
} ]
}
Table:
+------+------+------+
| Col1 | Col2 | Col3 |
+------+------+------+
| Row1 | | true |
| Row2 | Data | |
+------+------+------+
[/code]
Can the plugin handle this type of setup?
This discussion has been closed.
Replies
Use sDefaultContent and set it to an empty string. Then null or undefined data (as is the case here) will be shown with the default content rather than showing a warning.
Allan