Implementing a datagrid

Datagrids are the strong points of websheets. Websheets have been called 'Excel-killers'. If that is true, than datagrids are the weapons.

Getting ready

Make sure that there is a page available to implement the datagrid on. We can take the Sales overview page from the previous recipe and elaborate on that.

If you didn't create that page yet, do so before starting this recipe.

How to do it...

Let's say that the company in this example sells only one kind of product. They have no need for an elaborate database, so they would like a simple grid to monitor all sales.

  1. When on the Sales Overview page, click the button on the right side called New Datagrid.
  2. On the first page of the wizard, select the option From Scratch.
  3. Next, enter the title and columns for the datagrid as shown in the following screenshot:
    How to do it...
  4. Click Create.

What we see now is an empty datagrid. To add data to the grid, press the Add Row button.

How to do it...

Data can now be entered into the datagrid, row-by-row.

How to do it...

When a row is done, click Save to finish or click Save and Add Another to continue entering data.

After the last row is entered and the page is run, we will see a nice table of data quite similar to an Interactive Report in Application Express.

How to do it...

Under the Actions button, we can find some of the visual attributes to filter and sort the data in the grid.

Everything looks alright, so now we can put the datagrid onto the Sales Overview page.

  1. Go to the Sales Overview page and click New Section.
  2. We can see two new options: Data and Chart. Click Data and Next.
  3. Now select Sales Overview from the select list at Data Grid, click Next and Create.
  4. The datagrid is now added as a section to the page.
How to do it...

How it works...

Datagrids look like normal tables in an interactive report. But in the background they are not based on real database tables. APEX keeps the data for datagrids inside metadata-tables. That is why we don't have to define tables before creating pages with datagrids. The only drawback is that there are limitations on things like the number of columns, indexing, and so on because of that.

See also

The recipe called Creating a websheet application from a spreadsheet will elaborate on this subject and show some of the advanced features of Datagrids.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.176.228