各位高手:
      我在对树节点进行管理时想要可以上下调整节点位置,节点列表在GridView中展示,节点旁边对应有上移,下移按钮,数据库中 showOrder为排序列,不知如何实现上移下移,谢谢.

解决方案 »

  1.   

    点上移、下移的时候更新数据库中节点的ShowOrder就可以了,不过注意要判断不要超过父节点
      

  2.   

    三句Update就可以了
    假如3,4行交换位置:
    Update XXX set ShowOrder=-1 where ShowOrder=3
    Update XXX set ShowOrder=3 where ShowOrder=4
    Update XXX set ShowOrder=4 where ShowOrder=-1
      

  3.   

    假如当前节点的showOrder为3,id为11(前提是showOrder是按顺序的,如:1,2,3,4,5...)
    上移时
    update table set showOrder=2 where id=11
    update table set showOrder=3 where id=? //这里的id就是当前节点上一个的节点的id下移时
    update table set showOrder=4 where id=11
    update table set showOrder=3 where id=? //这里的id就是当前节点下一个的节点的id
      

  4.   

    不是很好实现,当删除增加节点showOrder就乱了,有朋友做过吗,