目前网上主流的有四种方案:
1 dHtmlxGrid
http://www.scbr.com/docs/prodUCts/dhtmlxGrid/index.shtml
免费版可以填充表格,表格也非常漂亮。但是无法得到数据,或者将修改过的表格内容序列化成XML,只有专业版才可以。
2 activewidgets-grid 1.0.0
http://www.activewidgets.com/
功能非常强大,甚至可以分页,界面也有好看的皮肤。但1.0 同样无法取数据。2.0也不是免费的,
3 DHTMLGrid Ver0.92
http://dhtmlgrid.sourceforge.net/
功能及其简单,界面比较难看
4 os3grid 0.6
http://os3grid.sourceforge.net
功能还可以,不过界面简单。虽然架构不好,但是可以扩展,而且究竟是LGPL的许可。
最终我还是选用os3grid来做工资录入界面.
创建界面的代码为:
// Create an OS3Grid instance
var g = new OS3Grid ();
// Set the callback for modifications
g.onchange = row_modified;
g.set_size ( "400px", "200px" );
// Grid Headers are the grid column names
g.set_headers ( 'nick', 'name', 'email addr' );
// If contents is bigger than container, Grid will automatically show scrollbars
g.set_scrollbars ( true );
// The grid will have a solid border (these are Css attributes)
g.set_border ( 1, "solid", "#cccccc" );
// Now, we add some rows
g.add_row ( "fsoft", "Fabio Rotondo", "fsoft (@) sourceforge (dot) net" );
g.set_row_attr ( -1, 'magic', 'magic-fsoft' );
g.set_row_attr ( -1, 'changed', 'NO' );
g.add_row ( "nick", "Nick Fury", "nick (@) sourceforge (dot) net" );
g.set_row_attr ( -1, 'magic', 'magic-nick' );
g.set_row_attr ( -1, 'changed', 'NO' );
g.add_row ( "john", "John JJ Jameson", "john (@) sourceforge (dot) net" );
g.set_row_attr ( -1, 'magic', 'magic-john' );
g.set_row_attr ( -1, 'changed', 'NO' );
g.add_row ( "reds", "Mary Jane Watson", "mj (@) sourceforge (dot) net" );
g.set_row_attr ( -1, 'magic', 'magic-mj' );
g.set_row_attr ( -1, 'changed', 'NO' );