posts - 81, comments - 262, trackbacks - 0

Table Row Reordering


This small bit javascript reorders a table's rows in groups.

 

function moveRow(table, pos1, pos2)
{
    var multiplicity = 5;
   
    var obj = table.children(0);
    if (obj.children.length > ((pos1+1)*multiplicity-1) &&
obj.children.length > ((pos2+1)*multiplicity-1)

        && pos1 >= 0 && pos2 >=0 && pos1 != pos2)
    {
        for (var i = 0; i < multiplicity; i ++)
        {
            var node1 = obj.children(pos1*multiplicity + i);
            var node2 = obj.children(pos2*multiplicity + i);
            node1.swapNode(node2);
        }
    }

}


Print | posted on Saturday, May 10, 2008 4:52 PM | Filed Under [ Web Programming ]

Powered by:
Powered By Subtext Powered By ASP.NET