Saturday, 15 May 2010

javascript - .append to create sortable table from within function -



javascript - .append to create sortable table from within function -

i have list of options different values. hear events of list using:

value = $('#list option:select').val();

i perform different actions based on value so

if (value == 'a') { $('table').contents(); //clear content $('table').append( '<table class="sortable"> <thead> <tr> <th class="">name</th> <th class="">unit1</th> <th class="">unit2</th> </tr> </thead> <tbody> <tr> <td>fitz, marvin</td> <td>$3300</td> <td>5554</td> </tr>'); //add content } else if (value == "b" { $('table').contents(); //clear content $('table').append(<new table>);

to i'm following: http://www.kryogenix.org/code/browser/sorttable/ using sorttable.js script source.

the table updates doesn't seem effected sorttable.js. given .append happends within function (or other reason), have approach differently normally?

i think subtle issue when table made sortable sorttable library. looking @ source, think adding sorttable.init() after append new table should prepare this.

javascript jquery jquery-ui

No comments:

Post a Comment