|
|
|
|
|
|
Linux Hosting NT/2000 Hosting DYO Internet Access HTMLez.com JAVASCRIPTez.com PHPez.com
|
Sortable TablesAt HTMLez.com I shared information that I had learned at http://builder.cnet.com/webbuilding/pages/Programming/Scripter/080999/?tag=st.bl.7264cd3.plbl about creating sortable tables on a web page. This javascript file you can obtain from their site.Here I will show how to make this sortable tables become generically useful on any asp enabled web server. This example, available for downloading in .txt format (simply save as a .asp file as required on your server). Click here to see a sample showing .asp Sortable Tables. We will automate by enabling this one asp file to process any .csv (comma delimited file). These .csv files can easily be created in Excel and exported as a comma delimited file. Make the first row the Headers for the table, being sure there is one header for each column in the table. Data fields in some columns may be blank but be sure each column has a header value in the A row. This asp generic program functions as follows:
where the first javascript array is the data array and the 2nd array is the Header/Button arrayWe allow javascript to create the buttons and the data table with the following assistance:
id,rows,columns,border,width,align are parms for dynamically defining the table.And we are almost finished with our customization to the Sortable Tables. We still need to setup the definitions for sorting a column numerically (since sortable tables sorts alphabetically by default). We do this with the following asp code:
And our customization is complete.Oh, you want to know how to call this generical Sortable Tables page? Create this link: <a href="genSortTables.asp?fname=phonelist.csv &twidth=90&talign=right&bsize=1">MyLink</a>The &tnums=00000004 parameter contains 00 for each column to be sorted alphabetically and 04 for the fourth column to be sorted numerically.or for numeric columns<a href="genSortTables.asp?fname=phonelist.csv& twidth=90&talign=right&bsize=1&tnums=00000004"> MyLink</a> Enjoy using sortable Tables in the future. Just download this example as instructed above and use this code without changing anything within the script tags. Just link to the page using the parms shown.
|
Average Customer Review: http://www.wrox.com |