lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

edit row with popup #746

Closed smohammedyasin closed 7 years ago

smohammedyasin commented 7 years ago

How can i edit table row using angularjs popup here or bootstrap popup. any tips please

MrWook commented 7 years ago

Hello @smohammedyasin, <tr ng-repeat="row in rowCollection" ng-click="edit(row)"> <td>{{row.id}}</td> <td>{{row.firstName}}</td> </tr> or <tr ng-repeat="row in rowCollection"> <td>{{row.id}}</td> <td>{{row.firstName}}</td> <td><button ng-click="edit(row)" type="button">Edit</button></td> </tr>

add a ng-click event to the row or add a new column "edit" and insert a button into this new column with a ng-click event. In the function for the click event you open the modal window with the plugin you provided or the ui-bootstrap modal window. In the modal window you can use input fields or radio buttons or what ever. Both plugins have a callback function when you close the modal window. In this callback you can transfer the changed columns into the smart-table controller and override the old row data.