| 導購 | 订阅 | 在线投稿
分享
 
 
 

選取合適的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- 王朝網路 版權所有