How to assign users on different table from one group?

Hello, I am implementing Seating Chart

what I want is
users group with 4 users moved to table of 3 node, then there is one user who is not assigned to any seat, I want to move that user to other table if there is a table beside it (programmatically)

here is the video for that
Video Link

here is the screenshot

Note that the mouseDrop event handlers for tables (set in the tableStyle function) and for people (the default template category) call assignPeopleToSeats.

assignPeopletoSeats in turn calls assignSeat to assign a person to a seat at a table and then calls positionPeopleAtSeats on a table to make sure each person at a table is properly positioned at each seat. So you will note that the design of the Seating Chart sample is oriented towards assigning people to seats at a particular table. You will need to change this code so that it tries to assign people who were not able to be seated at the table to another table.

I’m not sure about all of the details, but I suspect you will want to change assignSeat to return a collection of people for which it was unable to assign seats. That way the calls to assignSeat in assignPeopleToSeats can collect unassigned people nodes and find nearby table nodes where they could be assigned seats.

But you’ll need to figure out your policy for choosing table(s) with available empty seats. Maybe you want to just get the closest empty seats, in order of distance. Or maybe you want to choose a table with enough empty seats for all of the unassigned people. Or maybe some other policy that you need to decide and implement.

OK, I just tried this. It’s actually even easier than what I described.

First, the changes to the assignPeopleToSeats function:

      . . .
      // OK -- all Nodes are people, call assignSeat on each person data
      const unassigned = new go.Set();
      coll.each(n => assignSeat(node,, pt, unassigned));
      if (unassigned.count > 0) {

The extra argument to assignSeat:

    function assignSeat(node, guest, pt, unassigned) {

And that argument go.Set gets added to when findClosestUnoccupiedSeat fails:

      if (closestseatname) {
        . . .
      } else {