vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Add function problem #666

Open SebastianCBA opened 7 years ago

SebastianCBA commented 7 years ago

I have the add function:

          $scope.add = function() {
            $scope.inserted = {
              sector_sheet_id: 0
                };
            var row = $scope.sectorSheets.unshift($scope.inserted);
          };            

When I press the add button, the new row does not appear, however when I press on edit button the new record appears.. How to make the new record appear when I click on add button?

Thanks in advance.

ckosloski commented 7 years ago

Can you post the code you have for your add button that doesn't work and your edit button that does.

SebastianCBA commented 7 years ago

Hi ckosloski! I has tested that teh button works inside teh view, but teh add new button should go out of sight... Within teh view use this code:

<div><button class="btn btn-primary blue-500-b white" ng-click="add()">Add an entry <span class="zmdi zmdi-plus-circle-o zmdi-hc-fw"></span></button></div>

And it worked ... but outside of the view use this code:

<button class="btn btn-primary blue-500-b white" onclick="angular.element(document.getElementById('EditableRowCtrl')).scope().add();">Add an entry <span class="zmdi zmdi-plus-circle-o zmdi-hc-fw"></span></button>

And it does not work for me... do you understand?

ckosloski commented 7 years ago

If you have angular debugging turned off, getting scope on the element won't work.

SebastianCBA commented 7 years ago

Hi ckosloski! With this

app.config(function($logProvider, $popoverProvider) { $logProvider.debugEnabled(true); //added angular.extend($popoverProvider.defaults, { html: true }); })

Now, the button outside teh view works! Thank you, you are the best!

SebastianCBA commented 7 years ago

Now, I need export the table to excel file, do you have some idea for that?

ckosloski commented 7 years ago

Here is a stackoverflow that might help