Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning DHTMLX Suite UI

You're reading from   Learning DHTMLX Suite UI Create your first single-page JavaScript application using multiple DHTMLX components and a touch of HTML5

Arrow left icon
Product type Paperback
Published in Oct 2013
Publisher Packt
ISBN-13 9781849699334
Length 132 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Eli Geske Eli Geske
Author Profile Icon Eli Geske
Eli Geske
Arrow right icon
View More author details
Toc

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image