Skip to content

Feature request: exposed expandJSON method #5

@jtrumbull

Description

@jtrumbull

@djhvscf: I forked this repository and was going to create some PRs. Didn't want to get to far if this is something that you are working on -or did't want in the extension.

I don't have any working code yet, but the function would reverse the results of flatJSON, to the data's native JSON format.

$.fn.bootstrapTable.methods.push('expandJSON');

Usage:

// On Array of Objects
$('#table').bootstrapTable('expandJSON', [
    {
        "user.name": "jtrumbull",
        "user.mood": "bored",
        "user.array.0.key1": "a"
        "user.array.1.key1": "b"
        "user.array.3.key1": "c"
    },
    {...},
    {...}
]);

// or on single Object
$('#table').bootstrapTable('expandJSON', {...});

Would produce:

[
    {
        "user": {
            "name": "jtrumbull",
            "mood": "bored",
            "array": [
                { "key1": "a" },
                { "key1": "b" },
                { "key1": "c" }
            ]
        }
    },
    {...},
    {...}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions