Gladiator Components >> Scrollable Table and Table Editor Components >> ScrollableTable API >> TableEditor API
Try It!
Scroll through the table and then click on a cell to edit it's contents:
Description
This page provides of demo of two components that are frequently used together: the scrollable table component, and the table editor component.
Scrollable Table
Attempting to display large amounts of tabular data using standard HTML tables can be a challenge. The ScrollableTable class shown here provides a convenient solution because it converts a standard HTML table into a scrollable one. Although there are currently a few constraints present, in general the scrollable table simply inherits the CSS styling from the original HTML table. Therefore designers are for the most part able to concentrate on the CSS table styling attributes with which they are already familiar without having to worry about how to apply CSS to the scrollable table.
Notice that the gScrollableTable employs a liquid layout which fills the dimensions of a containing
div (a Gladiator window in the
example shown here). To create a fixed-sized table, just place the scrollable table in a fixed-size div.
Table Editor
Sometimes it is more convenient to edit data directly in a tabular form. The Gladiator table editor provides
the basis for this functionality.
Additional functionality for saving data in a changed table is not provided by the TableEditor class by itself, but can be built
using other Gladiator components such as the AJAX-based gRequest class.
In the example shown here, the values in any of the scrollable column cells can be edited. Just click
on a cell to change the value.
Although not shown here, when necessary it is also possible to edit the values in the fixed columns too -- This
is done by simply setting the fixedColumnCount of the gTableEditor to be less than
the fixedColumnCount of the gScrollableTable itself.
In addition, the table editor has three modes of operation.
The default mode allows
editing of any and all cells outside of non-editable "fixed" or "key" column range.
In the second mode, editing is restricted to only those cells (tds) where
an "editable" attribute on the has been set to "y" (yes).
Finally, in the third mode, editing is allowed in all cells except those
where the "editable" attribute has been set to "n" (no).
Designers should consider using CSS style attributes to make it clear to users which table cells
are editable and which are not.
See the API documentation for more information on how to set table editor modes.
Information For Developers
A static, read-only scrollable table can be created using an instance of the Gladiator ScrollableTable class. An editable table can be created by adding a TableEditor. Links to the API documentation for these two classes are provided below:
| State | Total population | White | African American | Native American | Asian | Pacific Islander | Other | Total population | Urban | Inside urbanized areas | Inside urban clusters | Rural |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Alabama | 4,447,100 | 3,199,953 | 1,168,998 | 44,449 | 39,458 | 3,169 | 38,201 | 4,447,100 | 2,465,673 | 1,941,208 | 524,465 | 1,981,427 |
| Alaska | 626,932 | 463,999 | 27,147 | 119,241 | 32,686 | 5,515 | 15,151 | 626,932 | 411,257 | 277,670 | 133,587 | 215,675 |
| Arizona | 5,130,632 | 3,998,154 | 185,599 | 292,552 | 118,672 | 13,415 | 677,392 | 5,130,632 | 4,523,535 | 3,908,163 | 615,372 | 607,097 |
| Arkansas | 2,673,400 | 2,170,534 | 427,152 | 37,002 | 25,401 | 3,129 | 48,267 | 2,673,400 | 1,404,179 | 860,747 | 543,432 | 1,269,221 |
| California | 33,871,648 | 21,490,973 | 2,513,041 | 627,562 | 4,155,685 | 221,458 | 6,575,625 | 33,871,648 | 31,989,663 | 29,950,008 | 2,039,655 | 1,881,985 |
| Colorado | 4,301,261 | 3,665,638 | 190,717 | 79,689 | 120,779 | 10,153 | 364,846 | 4,301,261 | 3,633,185 | 3,212,849 | 420,336 | 668,076 |
| Connecticut | 3,405,565 | 2,835,974 | 339,078 | 24,488 | 95,368 | 4,076 | 186,234 | 3,405,565 | 2,988,059 | 2,848,497 | 139,562 | 417,506 |
| Delaware | 783,600 | 594,425 | 157,152 | 6,069 | 18,944 | 671 | 20,391 | 783,600 | 627,758 | 531,032 | 96,726 | 155,842 |
| District of Columbia | 572,059 | 184,309 | 350,455 | 4,775 | 17,956 | 785 | 28,627 | 572,059 | 572,059 | 572,059 | 0 | 0 |
| Florida | 15,982,378 | 12,734,292 | 2,471,730 | 117,880 | 333,013 | 23,998 | 697,074 | 15,982,378 | 14,270,020 | 13,470,104 | 799,916 | 1,712,358 |
| Georgia | 8,186,453 | 5,412,371 | 2,393,425 | 53,197 | 199,812 | 9,689 | 241,298 | 8,186,453 | 5,864,163 | 5,010,117 | 854,046 | 2,322,290 |
| Hawaii | 1,211,537 | 476,162 | 33,343 | 24,882 | 703,232 | 282,667 | 47,603 | 1,211,537 | 1,108,225 | 835,912 | 272,313 | 103,312 |
| Idaho | 1,293,953 | 1,201,113 | 8,127 | 27,237 | 17,390 | 2,847 | 64,389 | 1,293,953 | 859,497 | 603,808 | 255,689 | 434,456 |
| Illinois | 12,419,293 | 9,322,831 | 1,937,671 | 73,161 | 473,649 | 11,848 | 847,369 | 12,419,293 | 10,909,520 | 9,737,473 | 1,172,047 | 1,509,773 |
| Indiana | 6,080,485 | 5,387,174 | 538,015 | 39,263 | 72,839 | 4,367 | 119,586 | 6,080,485 | 4,304,011 | 3,410,932 | 893,079 | 1,776,474 |
| Iowa | 2,926,324 | 2,777,183 | 72,512 | 18,246 | 43,119 | 2,196 | 46,858 | 2,926,324 | 1,787,432 | 1,114,790 | 672,642 | 1,138,892 |
| Kansas | 2,688,418 | 2,363,412 | 170,610 | 47,363 | 56,049 | 3,117 | 107,789 | 2,688,418 | 1,920,669 | 1,207,832 | 712,837 | 767,749 |
| Kentucky | 4,041,769 | 3,678,740 | 311,878 | 24,552 | 37,062 | 3,162 | 31,805 | 4,041,769 | 2,253,800 | 1,566,760 | 687,040 | 1,787,969 |
| Louisiana | 4,468,976 | 2,894,983 | 1,468,317 | 42,878 | 64,350 | 3,237 | 47,775 | 4,468,976 | 3,245,665 | 2,535,614 | 710,051 | 1,223,311 |
| Maine | 1,274,923 | 1,247,776 | 9,553 | 13,156 | 11,827 | 792 | 5,227 | 1,274,923 | 512,878 | 313,952 | 198,926 | 762,045 |
| Maryland | 5,296,486 | 3,465,697 | 1,525,036 | 39,437 | 238,408 | 6,179 | 134,621 | 5,296,486 | 4,558,668 | 4,247,989 | 310,679 | 737,818 |
| Massachusetts | 6,349,097 | 5,472,809 | 398,479 | 38,050 | 264,814 | 8,704 | 320,907 | 6,349,097 | 5,801,367 | 5,635,129 | 166,238 | 547,730 |
| Michigan | 9,938,444 | 8,133,283 | 1,474,613 | 124,412 | 208,329 | 7,276 | 195,724 | 9,938,444 | 7,419,457 | 6,578,451 | 841,006 | 2,518,987 |
| Minnesota | 4,919,479 | 4,466,325 | 202,972 | 81,074 | 162,414 | 5,867 | 89,042 | 4,919,479 | 3,490,059 | 2,711,750 | 778,309 | 1,429,420 |
| Mississippi | 2,844,658 | 1,761,658 | 1,041,708 | 19,555 | 23,281 | 1,901 | 18,635 | 2,844,658 | 1,387,351 | 679,928 | 707,423 | 1,457,307 |
| Missouri | 5,595,211 | 4,819,487 | 655,377 | 60,099 | 76,210 | 6,635 | 64,880 | 5,595,211 | 3,883,442 | 3,090,644 | 792,798 | 1,711,769 |
| Montana | 902,195 | 831,978 | 4,441 | 66,320 | 7,101 | 1,077 | 7,834 | 902,195 | 487,878 | 234,195 | 253,683 | 414,317 |
| Nebraska | 1,711,263 | 1,554,164 | 75,833 | 22,204 | 26,809 | 1,733 | 55,996 | 1,711,263 | 1,193,725 | 805,111 | 388,614 | 517,538 |
| Nevada | 1,998,257 | 1,565,866 | 150,508 | 42,222 | 112,456 | 16,234 | 193,720 | 1,998,257 | 1,828,646 | 1,676,309 | 152,337 | 169,611 |
| New Hampshire | 1,235,786 | 1,198,927 | 12,218 | 7,885 | 19,219 | 777 | 10,895 | 1,235,786 | 732,335 | 551,828 | 180,507 | 503,451 |
| New Jersey | 8,414,350 | 6,261,187 | 1,211,750 | 49,104 | 524,356 | 10,065 | 583,527 | 8,414,350 | 7,939,087 | 7,753,792 | 185,295 | 475,263 |
| New Mexico | 1,819,046 | 1,272,116 | 42,412 | 191,475 | 26,619 | 3,069 | 352,963 | 1,819,046 | 1,363,501 | 862,344 | 501,157 | 455,545 |
| New York | 18,976,457 | 13,275,834 | 3,234,165 | 171,581 | 1,169,200 | 28,612 | 1,721,699 | 18,976,457 | 16,602,582 | 15,504,619 | 1,097,963 | 2,373,875 |
| North Carolina | 8,049,313 | 5,884,608 | 1,776,283 | 131,736 | 136,212 | 8,574 | 223,222 | 8,049,313 | 4,849,482 | 3,760,871 | 1,088,611 | 3,199,831 |
| North Dakota | 642,200 | 599,918 | 5,372 | 35,228 | 4,967 | 475 | 4,042 | 642,200 | 358,958 | 230,797 | 128,161 | 283,242 |
| Ohio | 11,353,140 | 9,779,512 | 1,372,501 | 76,075 | 159,776 | 6,984 | 128,671 | 11,353,140 | 8,782,329 | 7,311,293 | 1,471,036 | 2,570,811 |
| Oklahoma | 3,450,654 | 2,770,035 | 284,766 | 391,949 | 58,723 | 5,123 | 102,585 | 3,450,654 | 2,254,563 | 1,483,638 | 770,925 | 1,196,091 |
| Oregon | 3,421,399 | 3,055,670 | 72,647 | 85,667 | 127,339 | 16,019 | 176,866 | 3,421,399 | 2,694,144 | 1,976,124 | 718,020 | 727,255 |
| Pennsylvania | 12,281,054 | 10,596,409 | 1,289,123 | 52,650 | 248,601 | 8,790 | 238,700 | 12,281,054 | 9,464,101 | 8,210,985 | 1,253,116 | 2,816,953 |
| Rhode Island | 1,048,319 | 910,630 | 58,051 | 10,725 | 28,290 | 1,783 | 69,002 | 1,048,319 | 953,146 | 928,119 | 25,027 | 95,173 |
| South Carolina | 4,012,012 | 2,727,208 | 1,200,901 | 27,456 | 44,931 | 3,778 | 51,346 | 4,012,012 | 2,427,124 | 1,873,821 | 553,303 | 1,584,888 |
| South Dakota | 754,844 | 678,604 | 6,687 | 68,281 | 6,009 | 556 | 5,351 | 754,844 | 391,427 | 194,584 | 196,843 | 363,417 |
| Tennessee | 5,689,283 | 4,617,553 | 953,349 | 39,188 | 68,918 | 4,587 | 72,929 | 5,689,283 | 3,620,018 | 2,964,722 | 655,296 | 2,069,265 |
| Texas | 20,851,820 | 15,240,387 | 2,493,057 | 215,599 | 644,193 | 29,094 | 2,766,586 | 20,851,820 | 17,204,281 | 14,795,862 | 2,408,419 | 3,647,539 |
| Utah | 2,233,169 | 2,034,448 | 24,382 | 40,445 | 48,692 | 21,367 | 113,950 | 2,233,169 | 1,970,344 | 1,748,080 | 222,264 | 262,825 |
| Vermont | 608,827 | 596,079 | 4,492 | 6,396 | 6,622 | 308 | 2,727 | 608,827 | 232,448 | 105,365 | 127,083 | 376,379 |
| Virginia | 7,078,515 | 5,233,601 | 1,441,207 | 52,864 | 304,559 | 9,984 | 190,308 | 7,078,515 | 5,169,955 | 4,713,302 | 456,653 | 1,908,560 |
| Washington | 5,894,121 | 5,003,180 | 238,398 | 158,940 | 395,741 | 42,761 | 287,400 | 5,894,121 | 4,831,106 | 4,303,803 | 527,303 | 1,063,015 |
| West Virginia | 1,808,344 | 1,733,390 | 62,817 | 10,644 | 11,873 | 887 | 5,579 | 1,808,344 | 832,780 | 512,427 | 320,353 | 975,564 |
| Wisconsin | 5,363,675 | 4,827,514 | 326,506 | 69,386 | 102,768 | 4,310 | 104,662 | 5,363,675 | 3,663,643 | 2,842,494 | 821,149 | 1,700,032 |
| Wyoming | 493,782 | 462,902 | 4,863 | 15,012 | 4,107 | 614 | 15,610 | 493,782 | 321,344 | 125,921 | 195,423 | 172,438 |
| Puerto Rico | 3,808,610 | 3,199,547 | 416,296 | 26,871 | 17,279 | 2,894 | 317,059 | 3,808,610 | 3,595,521 | 3,476,691 | 118,830 | 213,089 |