| 订阅 | 在线投稿
分享
 
 
 

选取合适的dHtml Grid方案

来源:互联网网民  宽屏版  评论
2006-04-20 05:58:22

目前网上主流的有四种方案:

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' );

g.add_row ( "white", "Barry White", "barryw (@) sourceforge (dot) net" );

g.set_row_attr ( -1, 'magic', 'magic-barryw' );

g.set_row_attr ( -1, 'changed', 'NO' );

// Enable sortable rows

g.set_sortable ( true );

// Enable highlight of rows with the mouse

g.set_highlight ( true );

g.set_col_editable ( 1, "txt" );

g.set_col_editable ( 2, "txt" );

g.sort_on_edit = true;

// Show the grid replacing the original HTML object with the "grid" ID.

g.render ( 'grid' );

取得数据的代码,这是最关键的

var l = g.length ();

var t;

var data, attrs;

var s = "";

var i, v;

for ( t = 0; t < l; t ++ )

{

data = g.get_row ( t );

alert(data[0]+data[1]+data[2]);

}

 
特别声明:以上内容(如有图片或视频亦包括在内)为网络用户发布,本站仅提供信息存储服务。
 
目前网上主流的有四种方案: 1 dhtmlxGrid [url=http://www.scbr.com/docs/products/dhtmlxGrid/index.shtml]http://www.scbr.com/docs/products/dhtmlxGrid/index.shtml[/url] 免费版可以填充表格,表格也非常漂亮。但是无法得到数据,或者将修改过的表格内容序列化成xml,只有专业版才可以。 2 activewidgets-grid 1.0.0 [url=http://www.activewidgets.com/]http://www.activewidgets.com/[/url] 功能非常强大,甚至可以分页,界面也有好看的皮肤。但1.0 同样无法取数据。2.0也不是免费的, 3 DHTMLGrid Ver0.92 [url=http://dhtmlgrid.sourceforge.net/]http://dhtmlgrid.sourceforge.net/[/url] 功能及其简单,界面比较难看 4 os3grid 0.6 [url=http://os3grid.sourceforge.net]http://os3grid.sourceforge.net[/url] 功能还可以,不过界面简单。虽然架构不好,但是可以扩展,而且毕竟是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' ); g.add_row ( "white", "Barry White", "barryw (@) sourceforge (dot) net" ); g.set_row_attr ( -1, 'magic', 'magic-barryw' ); g.set_row_attr ( -1, 'changed', 'NO' ); // Enable sortable rows g.set_sortable ( true ); // Enable highlight of rows with the mouse g.set_highlight ( true ); g.set_col_editable ( 1, "txt" ); g.set_col_editable ( 2, "txt" ); g.sort_on_edit = true; // Show the grid replacing the original HTML object with the "grid" ID. g.render ( 'grid' ); 取得数据的代码,这是最关键的 var l = g.length (); var t; var data, attrs; var s = ""; var i, v; for ( t = 0; t < l; t ++ ) { data = g.get_row ( t ); alert(data[0]+data[1]+data[2]); }
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有