fix(uiGrid): Fix race condition in data watcher
fix(uiGrid): Fix race condition in data watcher

The data watch function is creating a condition where promises can get
resolved out of order. If you are fetching both cell templates and data
over the network, it will operate thusly:

1. Data watch fires with empty data array, it sees there's no columns set
up and builds them from the columnDefs. This uses a promise from the
preCompileCellTemplates function.
2. The new data comes in, the data watcher sees there's columns set up now
so nothing has to be done and it sets the rows to your new data. Yay!
3. The promise from preCompileCellTemplates completes, and the data is
updated AGAIN, but this time with the original empty data set, blowing
away the data you fetched.

This fix changes the operation so we only call buildColumnDefsFromData()
when we actually HAVE data to use, and buildColumns() gets called if we
either have data OR have columnDefs.

Fixes #2053

Stiv/ui-grid,luisdesig/ui-grid,ntgn81/ui-grid,edmondpr/ng-grid,Stiv/ui-grid,reupen/ui-grid,nsartor/ui-grid,amyboyd/ng-grid,pkdevbox/ui-grid,ntmuigrid/ntmuigrid,bjossi86/ui-grid,b2io/ng-grid,frantisekjandos/ui-grid,Khamull/ui-grid,Julius1985/ui-grid,kenwilcox/ui-grid,ingshtrom/ui-grid,Namek/ui-grid,zamboney/ui-grid,SomeKittens/ui-grid,Servoy/ng-grid,jiangzhixiao/ui-grid,solvebio/ng-grid,Namek/ui-grid,jiangzhixiao/ui-grid,lookfirst/ui-grid,angular-ui/ng-grid-legacy,kamikasky/ui-grid,pzw224/ui-grid,sandwich99/ng-grid,Khamull/ui-grid,triersistemas/tr-grid,vidakovic/ui-grid,dlgski/ui-grid,kennypowers1987/ui-grid,eeiswerth/ng-grid,jintoppy/ui-grid,salarmehr/ng-grid,kenwilcox/ui-grid,louwie17/ui-grid,zen4s/ng-grid,cell-one/ui-grid,DmitryEfimenko/ui-grid,280455936/ng-grid,masterpowers/ui-grid,mage-eag/ui-grid,JLLeitschuh/ui-grid,xiaojie123/ng-grid,como-quesito/ui-grid,solvebio/ng-grid,seafoam6/ui-grid,dpinho17/ui-grid,zuohaocheng/ui-grid,edivancamargo/ui-grid,como-quesito/ui-grid,lookfirst/ui-grid,yccteam/ui-grid,aw2basc/ui-grid,masterpowers/ui-grid,angular-ui/ng-grid,ntmuigrid/ntmuigrid,zhaokunfay/ui-grid,luisdesig/ui-grid,domakas/ui-grid,Phalynx/ng-grid,seafoam6/ui-grid,cell-one/ui-grid,DmitryEfimenko/ui-grid,zen4s/ng-grid,dlgski/ui-grid,edmondpr/ng-grid,xiaojie123/ng-grid,pzw224/ui-grid,pzw224/ui-grid,mportuga/ui-grid,b2io/ng-grid,htettwin/ui-grid,Phalynx/ng-grid,Namek/ui-grid,jbarrus/ng-grid,klieber/ui-grid,Julius1985/ui-grid,zuzusik/ui-grid,kenwilcox/ui-grid,angular-ui/ng-grid-legacy,zmon/ui-grid,angular-ui/ui-grid,machinemetrics/ui-grid,zamboney/ui-grid,angular-ui/ng-grid-legacy,benoror/ui-grid,amyboyd/ng-grid,mboriani/ClearFilters,kennypowers1987/ui-grid,mage-eag/ui-grid,alex87/ui-grid,angular-ui/ui-grid,aw2basc/ui-grid,lookfirst/ui-grid,dlgski/ui-grid,eeiswerth/ng-grid,ciccio86/ui-grid,edmondpr/ng-grid,amyboyd/ng-grid,robpurcell/ui-grid,cityglobal/ui-grid,brucebetts/ui-grid,zuzusik/ui-grid,InteractiveIntelligence/ng-grid,yccteam/ui-grid,pkdevbox/ui-grid,JLLeitschuh/ui-grid,Khamull/ui-grid,angular-ui/ng-grid,Julius1985/ui-grid,jintoppy/ui-grid,Stiv/ui-grid,kamikasky/ui-grid,hahn-kev/ui-grid,jmptrader/ui-grid,edivancamargo/ui-grid,YonatanKra/ui-grid,zuzusik/ui-grid,wesleycho/ui-grid,klieber/ui-grid,mportuga/ui-grid,ingshtrom/ui-grid,zen4s/ng-grid,Lukasz-Wisniewski/ui-grid,dpinho17/ui-grid,angular-ui/ng-grid,htettwin/ui-grid,dbckr/ui-grid,JayHuang/ng-grid,jintoppy/ui-grid,cityglobal/ui-grid,DexStr/ng-grid,zuohaocheng/ui-grid,c1240539157/ui-grid,bjossi86/ui-grid,zmon/ui-grid,Cosium/ui-grid,reupen/ui-grid,dbckr/ui-grid,louwie17/ui-grid,Cosium/ui-grid,SomeKittens/ui-grid,Lukasz-Wisniewski/ui-grid,nishant8BITS/ng-grid,nsartor/ui-grid,therealtomas/ui-grid,jbarrus/ng-grid,JLLeitschuh/ui-grid,triersistemas/tr-grid,mportuga/ui-grid,bjossi86/ui-grid,DmitryEfimenko/ui-grid,JayHuang/ng-grid,therealtomas/ui-grid,c1240539157/ui-grid,sandwich99/ng-grid,bartkiewicz/ui-grid,mage-eag/ui-grid,c1240539157/ui-grid,alex87/ui-grid,280455936/ng-grid,ingshtrom/ui-grid,cityglobal/ui-grid,mirik123/ng-grid,dietergoetelen/ui-grid,machinemetrics/ui-grid,vidakovic/ui-grid,nishant8BITS/ng-grid,bartkiewicz/ui-grid,mirik123/ng-grid,sandwich99/ng-grid,hahn-kev/ui-grid,salarmehr/ng-grid,YonatanKra/ui-grid,brucebetts/ui-grid,SomeKittens/ui-grid,domakas/ui-grid,500tech/ng-grid,Phalynx/ng-grid,likaiwalkman/ui-grid,imbalind/ui-grid,angular-ui/ui-grid,cell-one/ui-grid,likaiwalkman/ui-grid,imbalind/ui-grid,jiangzhixiao/ui-grid,ntgn81/ui-grid,Servoy/ng-grid,reupen/ui-grid,jbarrus/ng-grid,nsartor/ui-grid,brucebetts/ui-grid,AdverseEvents/ui-grid,triersistemas/tr-grid,mirik123/ng-grid,zuohaocheng/ui-grid,benoror/ui-grid,AgDude/ng-grid,seafoam6/ui-grid,btesser/ng-grid,Cosium/ui-grid,como-quesito/ui-grid,salarmehr/ng-grid,bartkiewicz/ui-grid,robpurcell/ui-grid,klieber/ui-grid,Servoy/ng-grid,dbckr/ui-grid,alex87/ui-grid,zhaokunfay/ui-grid,btesser/ng-grid,ntmuigrid/ntmuigrid,kennypowers1987/ui-grid,ntgn81/ui-grid,zmon/ui-grid,ciccio86/ui-grid,hahn-kev/ui-grid,luisdesig/ui-grid,500tech/ng-grid,500tech/ng-grid,eeiswerth/ng-grid,robpurcell/ui-grid,jmptrader/ui-grid,likaiwalkman/ui-grid,JayHuang/ng-grid,therealtomas/ui-grid,AgDude/ng-grid,kamikasky/ui-grid,mboriani/ClearFilters,machinemetrics/ui-grid,yccteam/ui-grid,scottlepp/ui-grid,dietergoetelen/ui-grid,frantisekjandos/ui-grid,louwie17/ui-grid,AdverseEvents/ui-grid,wesleycho/ui-grid,DexStr/ng-grid,btesser/ng-grid,dpinho17/ui-grid,zhaokunfay/ui-grid,htettwin/ui-grid,ciccio86/ui-grid,scottlepp/ui-grid,solvebio/ng-grid,zamboney/ui-grid,frantisekjandos/ui-grid,mboriani/ClearFilters,AgDude/ng-grid,masterpowers/ui-grid,dietergoetelen/ui-grid,nishant8BITS/ng-grid,edivancamargo/ui-grid,benoror/ui-grid,scottlepp/ui-grid,InteractiveIntelligence/ng-grid,YonatanKra/ui-grid,xiaojie123/ng-grid,b2io/ng-grid,domakas/ui-grid,imbalind/ui-grid,DexStr/ng-grid,vidakovic/ui-grid,Lukasz-Wisniewski/ui-grid,pkdevbox/ui-grid,aw2basc/ui-grid,wesleycho/ui-grid,280455936/ng-grid,AdverseEvents/ui-grid,jmptrader/ui-grid,InteractiveIntelligence/ng-grid