javascript - Angular ngGrid Tree Control: Make a round trip on group expand -
i trying use nggrid
make of "tree-control" can build dynamically calling api's. nggrid
allows grouping on rows, yet nature of requires rows present @ beginning. unfortunate fact api pull generation data file integrity monitoring system insanely slow , stupid. instead, wish build "tree" dynamically on expansion of each generation.
i trying inject children (ngrows
) group-row (ngaggregate
) on callback, yet not think calling correct constructor ngrows
fact rows ignored control
through use of aggregatetemplate
option on gridoptions
nggrid
, have been able intersept expansion of group quite easily. (maybe not easily, still)
i've replaced ng-click
of default template:
ng-click="row.toggleexpand()"
with:
ng-click="$parent.$parent.rowexpanded(row)"
i know it's bit of hack, can later. now, gets job done.
the way discovered how work way $scope
rowexpanded
function setting breakpoint in nggrid
's "row.toggleexpand
" function , calling template so:
ng-click="row.toggleexpand(this)"
once retrieve group want, call api children said group. need make return children of row. decided calling nggrid
's ngrow
factory:
row.children = []; for(var = 0; < childdata.length; i++) { row.children[row.children.length] = row.rowfactory.buildentityrow(childdata[i], i); } row.toggleexpand();
... yet not appear working. rows not showing after expand! why won't rows show up?
by way
i've placed debugger statement within group-expand callback. long have debugger open, should catch breakpoint on expansion of group.
thanks everybody!
i found answer, i'm idiot....
i got control working, , realized total hack, have used control way meant used , have worked better, had better work-flow, , have saved me entire day of development. if wondering how use control way, answer don't.
i got stupid thing work updating data structure after round trip , forcing grid refresh, pretty obvious. had set grid options groups expanded , had control collapser icon logic myself, outside of nggrid. never called row.toggleexpand. hid rows null values function call within ng-if on rowtemplate. after said , done, put foot in mouth.
Comments
Post a Comment