Generally speaking the a/c will be on some sort of AC power long before it gets airborne. Either ground power or APU will be AC supply. If the a/c was powered up from 'dead' then the battery will be recharged by one of those sources probably hours before the engines are even started.
The 787 (and other a/c) will have a rather more sophisticated charging system than your car.
I am well aware of that, and I am also aware of the fact that the airplane batteries are normally not used when AC power is supplied.
But that doesn't mean the batteries are not charged in flight.