ivaynberg/select2 — pull request #1733 by flyerhzm (2013-09-19 03:26:33+00:00)
Title: append label only when formatted is not undefined

I'm using select2 to fetch remote infinite data, but all of the data belong to a optgroup, like

Empty (optgroup)
box1
box2
...

it works well for the first request, but from second request, it generates Empty optgroup every time, which is not my expectation.

My solution is override formatResult method, return undefined if the optgroup already exists, then fork select2, check `formatResult` result, if it is undefined, I don't append the container.