Quantcast
Viewing all articles
Browse latest Browse all 82147

What's a good way to handle ajax rows with mixed sets of columns?

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:

JSON: {
    "dataset": [ {
        "Col1": "Row1",
        "Col3": true
    }, {
        "Col1": "Row2",
        "Col2": "Data"
    } ]
}

Table:
+------+------+------+
| Col1 | Col2 | Col3 |
+------+------+------+
| Row1 |      | true |
| Row2 | Data |      |
+------+------+------+

Can the plugin handle this type of setup?

Viewing all articles
Browse latest Browse all 82147

Trending Articles