Testing the grid
Now, we are going to add a couple users with the storage
methods to test the grid. After testing we will clear the localStorage
.
Creating a user
The createUser
method was created in Chapter 3, Data Structures, Storage, and Callbacks to add a user to the localStorage
. We will use this to add two users to the grid and test the functionality. We will use a simplified version of the user object.
In the console type and run the following code snippet:
storage.createUser({firstName: "George", dob: new Date("1991")}); storage.createUser({firstName: "Steve", dob: new Date("1982")});
The createUser
saved the users into the localStorage
then called the dataChanged
method, which refreshed the grid. Now we know that when a user is added the grid will update. The following screenshot shows the grid with the two added users:
Removing a user
Now, we will test removing a user. Select a grid row and click on the remove button. The selected row is now removed. Clicking on the remove button removes...