Adam
Adam

Reputation: 20882

Jquery UI Sortable used with a Table

I wanted to ask if its possible to hook up sortable to table elements. Below is the structure. I read that elements don't work and my testing hasn't been successful:

<table id="photoPreviews"><tr>
 <td>... other elements here</td>
 <td>... other elements here</td>
 <td>... other elements here</td>
 <td>... other elements here</td></tr><tr>
 <td>... other elements here</td>
 <td>... other elements here</td>
 <td>... other elements here</td>
 <td>... other elements here</td>
</tr></table>

visually it looks like this:

enter image description here

thankyou

Upvotes: 0

Views: 108

Answers (1)

Robert
Robert

Reputation: 265

An html <table> should really only be used for tabular data... unless all else fails.

In this scenario, you'd be better off using a <ul>. Something like:

<ul id='photoPreviews'>
<li>Other elements go here. . .</li>
<li>Other elements go here. . .</li>
<li>Other elements go here. . .</li>
<li>Other elements go here. . .</li>
</ul>

After that, just follow the jquery sortable documentation for advanced features.

Good luck!

Upvotes: 1

Related Questions