2

I am trying to force refresh my bindonce table after editing few records but I dont know how to use bindonce refreshOn attribute.

HTML Code:

<tbody bindonce="filteredItems" refresh-on="refreshTaskList" ng-repeat="task in filteredItems | orderBy:sortingOrder:reverse">
<tr>
 <td><span bo-bind="task.serviceTypeName | isEmpty : 'None'"></span></td>
  <td ><span bo-bind="task.percentageCompleted | isEmpty : 'Not Started'"></span></td>
</tr>
</tbody>

I am calling this line in my Controller:

$scope.refreshTaskList();

Also, I tried calling this as well but nothing works:

$scope.$broadcast('refreshTaskList');

Can you anyone please help me how to use this in a proper manner?

hassassin
  • 5,024
  • 1
  • 29
  • 38
user972255
  • 1,828
  • 10
  • 32
  • 52

1 Answers1

3

Change it to: refresh-on="'refreshTaskList'"

Example:

<button ng-click="refresh()">Refresh table</button>

$scope.refresh = function () {
  $scope.$broadcast('refreshTaskList');
};

If it still doesn't work you might have a version that doesn't contain the refresh-on attribute.

Demo: http://plnkr.co/edit/nYPDMRG4b1OtkMolEEDQ?p=preview

tasseKATT
  • 38,470
  • 8
  • 84
  • 65
  • Excellent! I never know that we have to surround refreshTaskList with single quotes. – user972255 Mar 29 '14 at 17:07
  • For those looking the master branch of bindonce does not have `refresh-on` attribute baked in. You'll need to use the rebind-debug branch https://github.com/Pasvaz/bindonce/tree/rebind-debug which seems to have some issues still https://github.com/Pasvaz/bindonce/issues/42 – toxaq Dec 22 '14 at 12:30