javascript - How to make recursive ng-repeat Table -


i developing time-registration app. @ frontpage recursive/hierarchial table in angular on tasks in application.

i using ng-include, little unsecure structure.

so far have script/template:

<script type="text/ng-template" id="field_renderer.html">   <tbody ng-switch="x.open">   <tr     ng-repeat="x in tasks | orderby : ctrl.sortorder:ctrl.reverse | start: (ctrl.currentpage - 1) * ctrl.filter.maxsize | limitto: ctrl.filter.maxsize"     class="table_row" ng-class="x.haschildren == true? 'has-children' : 'no-children'">     <td ng-click="ctrl.selecttablerow($index, x.id)" class="clickable">       {{x.id}}       <span class="glyphicon sort-icon" ng-show="x.haschildren"             ng-class="{'glyphicon-chevron-up':!x.open,'glyphicon-chevron-down':x.open}"></span>     </td>     <td ng-click="ctrl.showtask(x.id)" class="project">{{x.project.projectname}}</td>     <td ng-click="ctrl.showtask(x.id)" class="sprint" ng-click="ctrl.gotosprint(x.sprint)">{{x.sprint.sprintname}}</td>     <td ng-click="ctrl.showtask(x.id)" class="area">{{x.area.areatext }}</td>     <td ng-click="ctrl.showtask(x.id)" ng-class="{'highest-priority': x.priority.id == 1}" style="text-align: center;"         class="priority">{{x.priority.id }}     </td>     <td ng-click="ctrl.showtask(x.id)" class="type">{{x.type.typetext}}</td>     <td ng-click="ctrl.showtask(x.id)" class="status">{{x.status.statustext}}</td>     <td ng-click="ctrl.showtask(x.id)" class="description">{{ x.descriptionshort }}</td>     <td ng-click="ctrl.showtask(x.id)" class="reg-date">{{x.regdate}}</td>     <td ng-click="ctrl.showtask(x.id)" class="responsible-intern">{{x.responsiblebytelab.username}}</td>     <td ng-click="ctrl.showtask(x.id)" class="dates">{{x.dates}}</td>     <td ng-click="ctrl.showtask(x.id)" class=" budget">{{x.budget}}</td>     <td ng-click="ctrl.showtask(x.id)" ng-class="{'wrong-estimate': x.remaining + x.used > x.estimate}"         class="time-est">{{x.estimate | minutestohours | date:'hh:mm'}}     </td>     <td ng-click="ctrl.showtask(x.id)" ng-class="{'wrong-estimate': x.remaining + x.used > x.estimate}"         class="time-remaining">       {{x.remaining | minutestohours | date:'hh:mm'}}     </td>     <td ng-click="ctrl.showtask(x.id)" ng-class="{'wrong-estimate': x.remaining + x.used > x.estimate}"         class="time-used">{{x.used | minutestohours | date:'hh:mm'}}     </td>     <td class="price" style="text-align: center;">       {{x.amount | currency}}     </td>     <td class="invoice-type">{{x.invoicetypestring}}</td>     <td><input type="checkbox"                ng-checked="ctrl.selectedtasks.indexof(x) > -1"                value="{{x}}"                ng-click="ctrl.toggleselection(x)"/>       <img title="group subtask" class="r-10" src="/images/icon_groupapplications.png" ng-click="ctrl.groupsubtask(x)">     </td>     <td class="invoice-nr">{{ x.invoicenr }}</td>     <td><img title="start working on task." ng-click="ctrl.newtaskwatcherlognodescription(x.project.id,x.id);"              src="/images/icon_clock.png" style="border-width:0px;cursor:pointer;"></td>   </tr>   <div ng-if="x.open">     <tr class="children_row" onload="x = tasks.childrentask" ng-include="'field_renderer.html'"></tr>   </div>   </tbody> </script> 

i calling this:

<tbody>   <tr class="clickable table_row" onload="tasks = ctrl.filteredtasks" ng-include="'field_renderer.html'"/> 

it seems work, extremely slow. how can improve performance? , right way of building recursive/hierarchial table?


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -