DataGrid / GridView Control
Download DataGrid v0.9
07-mar-2011 [9KB, Min, Gzip]
Implementation
<script type="text/javascript" src="datagrid-0.9.js"></script>

Note: Do not forget to include jQuery script.

Creating
new DataGrid(parent,options);

Use Ctrl+C to copy selected rows.
Options

new DataGrid("#div",{rowNumeration:true,horizontalGridLines:false});
OptionDescriptionTypeDefault Value
widthSets initial width, in pixels.Number480
heightSets initial height, in pixels.Number240
rowHeightSets the preferred row height for the DataGrid control, in pixels.Number18
horizontalGridLinesDetermines the presence of horizontal grid lines.Booleantrue
verticalGridLinesDetermines the presence of vertical grid lines.Booleantrue
rowNumerationDetermines whether or not to show row numbers.Booleanfalse
smoothScrollingSets smooth scrolling.Booleanfalse
Methods

name
String

Sets the text of the column header.

width
Number

Sets the width of the column, in pixels.

isNumber
Boolean

Determines the type of data: TRUE if data is number, FALSE - otherwise. Used to sort.

align
string

Determines text-align: "left", "center" or "right".

setData (data)Fill the DataGrid contol with data.

data
Array

Each element contains the data for one row in array.
In example above:

var data=[
	["Tokyo", "Japan", "Tokyo", 31480498],
	["Shanghai", "China", "Shanghai", 14608512],
	["Bombay", "India", "Maharashtra", 12692717],
	["Karachi", "Pakistan", "Sindh", 11627378],
	["New Delhi", "India", "Delhi", 10928270]	// and so on
];

filter (str)Filter the data.

str
String

Search string. Empty string clear the filter.

lv.filter("moscow");	// filter all rows which contain "moscow"



Comments
Guest1354276262732#4
this is great! but is there a way to capture the selected rows aside from ctr+c? thanks!
Guest1322268893419#3
thx
Guest1321679099252#2
No source...no good!
Guest1321622648282#1
So where's the source?
Guest1321622516851#0
10 seconds to load 1000 data. Why is it so slow?
Anyway great job, love the way it reorder column and copy to clipboard feature. Need some adjustment like row navigation by keyboard and paging. I should fork it later maybe :D. Thanks this is awesome stuff.