Thread Rating:
  • 574 Vote(s) - 2.78 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Files over HTTP4:Viewing RecordSet Data
06-15-2011, 04:46 PM, (This post was last modified: 06-20-2011, 04:32 PM by kino.)
#1
Files over HTTP4:Viewing RecordSet Data
The primary class for the display of RecordSet data in a tabular format is RecordGrid. This provides a row and column display with built-in functionality for managing the display. The display can easily be modified, allowing you to add your own colors and preferences.


An included navigation bar enables you to move to the first or last record, or up or down by one record. It also indicates the total number of records currently displayed, and the position of the current record in the display. By default, a RecordGrid includes the following functionality:


•Move columns

•Resize columns

•Sort records

•Filter records

•Select and edit a field

•Select one or more records


Modeling data in a RecordSet provides access to many convenience features and functions. This Curl Cue concentrates on displaying RecordSet data in a grid fomat. RecordSet data can also be transformed into other display types such as bar, pie, line, scatter, and bubble charts.


Creating a RecordGrid
Use the RecordGrid class to create the tabular display. The only input needed is the record-source which specifies the RecordSet data.

Notice that the rows and columns correspond to records and fields from the source RecordSet. The navigation panel at the bottom of the display enables you to move to the first or last record, or up or down by one record. It also indicates the total number of records currently displayed, and the position of the current record in the display.


Context sensitive menus are available by right-clicking on the column header. Options include sorting and filtering the displayed data.



Changing the RecordGrid Appearance
In the next example, we will change the appearance of the table using formatting options on the RecordGrid.

width='100%' height='740' src='/wiki/samples/generic-example.curl?Data/recordset-2.curl'


There are many options that can be used to specify the formatting. The following is a list of possibilities:

•alternate-row-background

•background

•color

•header-spec

•display-column-headers?

•display-filler-column?

•grid-line-color

•horizontal-grid-line-width

•vertical-grid-line-width


You can also turn off the standard grid features, such as the column headings (at the top of the display) and navigation panel (at the bottom of the display):

Code:
{curl 6.0, 7.0 applet}

{value
let items:RecordSet =
{RecordSet
{RecordFields
{RecordField "Item", domain = String},
{RecordField "Description", domain = String},
{RecordField "Quantity", domain = int}
},
{RecordData Item = "PR1400", Description = "Blue pens", Quantity = 12},
{RecordData Item = "LG4597", Description = "Envelopes", Quantity = 100},
{RecordData Item = "NP3400", Description = "Notepads", Quantity = 6},
{RecordData Item = "PN5601", Description = "Pencils", Quantity = 28}
}

let record-display:RecordGrid =
{RecordGrid
record-source = items,
display-navigation-panel? = false,
display-column-headers? = false,
height = 2.5cm,
width = 9.9cm,
display-filler-column? = true,
alternate-row-background = "#ccccff",
grid-line-color = "gray",
horizontal-grid-line-width = 2px,
vertical-grid-line-width = 4px
}
record-display
}

Specifying Columns and Display Formats
The default display for a RecordGrid is to sequentially present the defined Record data. In some cases, you may only want to display a portion of the data. In other cases you may want to rearrange the column order or provide special formatting.


You can create columns explicitly with RecordGridColumn, which enables you to set properties that control column appearance and function. Columns can also be created automatically and you only need to add a column yourself it you want to customize the column.
Code:
{curl 6.0, 7.0 applet}

{value
let items:RecordSet =
{RecordSet
{RecordFields
{RecordField "Item", domain = String},
{RecordField "Description", domain = String},
{RecordField "Quantity", domain = int},
{RecordField "Price", domain = double}
},
{RecordData Item = "PR1400", Description = "Blue pens", Quantity = 12, Price = 4.75},
{RecordData Item = "LG4597", Description = "Envelopes", Quantity = 100, Price = 12.25},
{RecordData Item = "NP3400", Description = "Notepads", Quantity = 6, Price = 8.50},
{RecordData Item = "PN5601", Description = "Pencils", Quantity = 28, Price = 3.45}
}

let record-display:RecordGrid =
{RecordGrid
record-source = items,
display-filler-column? = true,
alternate-row-background = "#ccccff",
grid-line-color = "gray",
horizontal-grid-line-width = 2px,
vertical-grid-line-width = 4px,
width = 9.9cm,
height = 3.5cm,
automatic-columns? = false,
{RecordGridColumn "Description"},
{RecordGridColumn "Item", font-weight = "bold"},
{RecordGridColumn "Price", halign = "right", format-spec = "$%.2f"}
}
record-display
}



We implemented this functionality by setting automatic-columns? = false and then specifying each RecordGridColumn. In the above example, we display three out of four record columns.


Modeling data in a RecordSet provides access to many convenience features and functions. We have already demonstrated the ease of displaying RecordSet data in a grid fomat. RecordSet data can also drive other display types such as bar, pie, line, scatter, and bubble charts



For more information regarding file connections, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Data Management and Display > Data Records and Grids



Attached Files
.jpg   recordgrid.jpg (Size: 13.15 KB / Downloads: 1,270)


Possibly Related Threads...
Thread Author Replies Views Last Post
  XML1:XML Data kino 3 9,750 10-21-2013, 12:48 PM
Last Post: Leta56
  Persistent Data1:Client-side Persistent Data kino 0 6,565 06-15-2011, 05:24 PM
Last Post: kino
  Files over HTTP3:Connected Data kino 0 7,072 06-15-2011, 04:42 PM
Last Post: kino
  Files over HTTP2:Organizing Data using RecordSets kino 0 5,492 06-15-2011, 04:35 PM
Last Post: kino
  Files over HTTP1:Files over HTTP kino 0 4,689 06-15-2011, 04:30 PM
Last Post: kino
  User Interface Basics4:Populating Control List Data kino 0 3,709 06-15-2011, 03:58 PM
Last Post: kino
Forum Jump:


Users browsing this thread:
3 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('19')