I can understand how you must have felt, something very similar happened to me last week( I wonder if it was the same lady or maybe her sister? Just kidding). I was shopping in Walmart with my 3 year old daughter and was about to leave, but I decided to check out the hair accesories in the girls section.Since my shopping cart was full with groceries and the space between the clothes rack is not very wide and there was another shopping cart with things in the way, I decided to leave the shopping cart a few steps in front of me about 6 small steps from me while I check out the bows, please keep in mind I had my daughter in plain view and didn't even take 2 minutes to check if there were any nice hair bows for my little girl, so anyways they did not have anything new so I grab my shopping cart and was about to leave when this lady around 50-60 years old that was seating in a buggy(those little cars from Wal-mart) looked at me angrily and scolded me for leaving my daughter for her to babysit!This are the exact words she used "How dare you leave your daughter for me to babysit while I look at this clothes, you saw me standing here and left your daughter for me to watch and wandered off! Ok,so at first I was not even sure she was talking to me because it was kind of surreal and it did not make sense, I mean you should have heard the way she said it to me, so still in disbelief I asked her what she was talking about, and she went on scolding me without any reason, so that's when I felt the need to give her a little piece of my mind.... But I didn't, why? 3 reasons 1. I'm a Christian and I belief I should behave like one,even at times when it's not easy, 2. I truly belief she has somekind of mental problem and I don't deal with crazy people, 3.My daughter was there and like I say to her 'if you are not going to say something nice than don't say anything at all'.
So what I did was say 'You know what? I don't have the time or the patience to deal with people like you, excuse me' and walked away with my head up and that was it short, simple, and effective. Now I'm sure someone else would have handled it better but, at least I did not loose my cool and I have nothing to be ashamed of.
What I gained from this experience is that even though you can't control what other people say or do to you, you can control the way you react to them, and although it's only natural to get upset or even furious at times, it's never wise to behave in front of your kids in a way you would not want them to behave in the future. So to answer your question I think you could have handled it better, but what is done is done, so turn this incident into a learning experience and explain to your children that we all make mistakes and your reaction was not the appropiate one and together come up with better ways to deal with people or situations that they will encounter in the future.