Creating a DataGrid Object
Data grid components offer a great way to display large amounts of data. This section will show you how to create a DataGrid object that will load XML, parse it, and delegate it to two other objects called the DataRow and the DataColumn, which we will create in the next section.
We first need to define and instantiate the DataGrid object before we can begin to use it. Listing 13.2 shows the code for accomplishing this. After the data grid has been defined, we will define its first method called init. This method creates the object properties, which in our case is simply a new array called rows.
Listing 13.2. Defining and Instantiating the DataGrid Object (DataGrid.js)
DataGrid = {}; DataGrid.init = function() { rows ... |
Get Ajax for Web Application Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.