akveo / blur-admin

AngularJS Bootstrap Admin Panel Framework
http://akveo.github.io/blur-admin/
Other
11.36k stars 3.09k forks source link

add delete button to smart table with filters #316

Open alexturbulent opened 7 years ago

alexturbulent commented 7 years ago

I want to add delete button and release it to any item of "smart table with filters". I just added button but it didn't work anyway. I wrote function is there any error there? $scope.deleteUser = function(index) { $scope.smartTableData.splice(index, 1); }; And to the button <button class="btn btn-danger editable-table-button btn-xs btn-inline" ng-click="deleteUser($index)"> Delete </button>

Irikos commented 7 years ago

Did you find a way to do this? I'm working now to dynamically add and remove row from smart table with filters.

Irikos commented 7 years ago

It's quite straightforward, you just need to use st-safe-src and a different collection (smart tables create a safe copy which it watches - you need to tell it to watch the original collection in order to update it's smart copy).

Check this documentation out, it explains everything: http://lorenzofox3.github.io/smart-table-website/

tienbasse93 commented 6 years ago

The documentation is fine, but it looks like st-safe-src and dynamic table data binding in blur-admin template is not working. When using it as explained in the official documentation of smart table, no data is displayed. Did anyone have this problem ?

Irikos commented 6 years ago

If you're sure you used it accordingly, then I didn't have this problem. However, the first time I discovered it, it took me a while to get it right and I had the same problem at the begginning.

Are you sure you initialize both Lists? (the safeOne and the normal one)

I used it like this:

<table class="table" st-table="safeCopyPayments" st-safe-src="payments"> 
  (....)
  <tr ng-repeat="payment" in safeCopyPayments" class="editable-row">
  (...)

and in the .ts I had $scope.safeCopyPayments = $scope.payments;