I like to get an <ul><li> and make it a nice table I will style with CSS.
I like the transformation to be made with jQuery
* Place|Name|Earning * 1|Paul|200$ * 2|Joe|400$ * 3|James|100$ * 4|Carl|1000$
on and on….
and make a table head with the first line of the <ul> and table cell with the others…
There will be maybe 4-5 <ul>s on the page.
To add icing to the cake, let sort it from the biggest earner to the smallest!
I have found this question:
it is exactly the opposite… but maybe a good start? I don’t know, I will check it out… but still left the question widely open.
I have found this question:
it is exactly the opposite… but maybe a good start? I don’t know, I will check it out… but still left the question widely open.
Another question related to the solution…
If I like to ‘delete’ the and replace it with the table..
I dont like to make an empty table..
here is the code… maybe not ‘optimized’ but it work
$('#texte').append('<div id='where_my_table_goes'></div>'); $('#where_my_table_goes').append(table); $('#my_oddly_formatted_list').remove();
anything better ?
no no no, since the question/answer become and plugin ti great… but doesn’t work anymore…
here is the bug… I like to call the plugin (tablerize) when the click event is toggle and REPLACE THE WHOLE UL by the table… which it dont do
Here is the little snippet of code :
<script type='text/javascript'> $(document).ready(function() { $('#texte > h1').next().hide(500); $('#texte > h1').click(function() { $(this > ul).tablerize(); $(this).toggle(500); }); }); </script>
not surprising it dont work.. I screw something for sure… and I tweek the plugin with no luck !…
I really like to keep that code:
$('texte').append('<div id='where_my_table_goes'></div>'); $(#where_my_table_goes'></div>').append(table); $('#my_oddly_formatted_list').remove();
that can become:
remove the ul append the div to (this) put the table into that div
do I even need a div ?
HELP!
It doesn’t work; here is the full page, maybe it will help a lot to SEE what it should do
http://www.acecrodeo.com/new/04-classement.php
I use the delay to hide just to see that the data is there…
after pressing on the title.. the tablerize should happend, delete the old ul and renplace it with the table, and the slidetoggle it
Ok.. there is the state now…
I know only to edit a answer and post it… no update button anywhere..
I like to give you a thumb up or anything that can help your rating… I just don’t know how
For the problem… I have post exacly what you give to me.. and it dont work… let see the link : http://www.acecrodeo.com/new/04-classement.php
here is the bug : it toggle the header…
I am so lost !
This is how you do it, if you have HTML that looks like this:
Then with jQuery you could write a plugin like this:
Which you could then call any of the following ways:
As far as sorting and so on, there are many plugins available to give this functionality to a table.
** EDIT **
The problem with your code is in these lines:
The
tablerizeplugin I wrote expects a<ul>element to tablerize. When you pass itthisyou are passing it theh1that was matched, not the<ul>. If you replace this line:With this line, which will find the UL element immediately after the header:
It should work as you intend.
Also: