lundi 15 juillet 2019

how to set a parameter of a json object inside a json array in ember

I need to access and change the a boolean parameter 'SELECTED' of a json object inside a json array using ember set method, but when i tried it I got error message "Assertion Failed: Cannot call set with 'false' key". Also tried to access the data using a temp Object.

structure of JSON Array:

[
    {
        "VALUE":
            [
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_added",
                    "NAME":"ADDED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_deleted",
                    "NAME":"DELETED"
                },
                {   "SELECTED":false,
                    "KEY":"audit_actions_disabled",
                    "NAME":"DISABLED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_enabled",
                    "NAME":"ENABLED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_modified",
                    "NAME":"MODIFIED"
                }
            ],
            "KEY":"",
            "NAME":"",
                            "SELECTED":false
    },
    {   
        "VALUE":
            [
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_deleted",
                    "NAME":"DELETED"
                }
            ],
        "KEY":"",
        "NAME":"",
                    "SELECTED":false
    },
    {
        "VALUE":
            [
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_added",
                    "NAME":"ADDED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_deleted",
                    "NAME":"DELETED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_disabled",
                    "NAME":"DISABLED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_enabled",
                    "NAME":"ENABLED"
                },
                {
                    "SELECTED":false,
                    "KEY":"audit_actions_updated",
                    "NAME":"UPDATED"
                }
            ],
        "KEY":"",
        "NAME":"",
                    "SELECTED":false
    }
]

I can get the values but can't change those in ember.




Aucun commentaire:

Enregistrer un commentaire