So I've been working with jQuery for the past few weeks - this is an open-source javascript library that was included with the Telerik controls we purchased. It is also, I believe, included with Visual Studio, or will be in a future release. Let me tell you, it makes things a lot easier. One example - moving table rows up or down in the table. This is actually quite difficult to do in Firefox (IE provides a non-standard method to do it for you) - the only way to do it that I've found is to clone the affected table row, remove the old one from the table and add the new one. I hate cloning objects. I'm not going to include the code on how to do this, because I didn't write it. But here's a link - http://www.w3hobbyist.com/web-designing/moving-table-rows-up-and-down-with-javascript/
Once I figured out that this was going to be hard to do, I thought I would try to do it in jQuery. I hit the documentation site for jQuery (http://docs.jquery.com/) and found the answer really quickly. In the examples below, pretend that tableRow is the row of the table that needs to be moved.
Moving an item down in the table: That is,actually, pretty amazing.
Once I figured out that this was going to be hard to do, I thought I would try to do it in jQuery. I hit the documentation site for jQuery (http://docs.jquery.com/) and found the answer really quickly. In the examples below, pretend that tableRow is the row of the table that needs to be moved.
Moving an item down in the table:
$(targetRow).insertAfter($(targetRow).next())
Moving an item up in the table:if (targetRow.rowIndex > 1) {
$(targetRow).insertBefore($(targetRow).prev());
}
$(targetRow).insertBefore($(targetRow).prev());
}