categorychildren.js 547 B

12345678910111213141516171819202122
  1. $(document).ready(function()
  2. {
  3. $.setAjaxForm('#childForm');
  4. var initSortable = function()
  5. {
  6. $('#childList').sortable({trigger: '.sort-handle', selector: '.tree', dragCssClass: ''});
  7. }
  8. var setChildrenKey = function()
  9. {
  10. $('[value=new]').each(function()
  11. {
  12. maxID ++;
  13. $(this).parents('.tree').find('[id*=children]').attr('name', 'children[' + maxID + ']');
  14. $(this).attr('name', 'mode[' + maxID + ']');
  15. })
  16. }
  17. initSortable();
  18. setChildrenKey();
  19. });