Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

question about using arrays of objects #123

@edwardsmarkf

Description

@edwardsmarkf

hello -

if i were using an array of objects like this:

var obj = [
{
    id: 1,
    firstName: 'Mark Jones', 
    address: '123 Swallow Lane',
},
{
    id: 2,
    firstName: 'Lori Smith', 
    address: '948 South Elm Street',
}
];


WatchJS.watch(obj, (prop, action, newvalue, oldvalue) => {

is it possible to get the row number? this works great:
obj[0].firstName='MARK'; // triggers alert with property, oldvalue and newvalue
Is there any way to determine the changed row number, or perhaps the id value?

also, is there any way to watch for inserts and deletes?

thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions