Вопрос

I have filled a ng-grid with SharePoint items, I want to open the SharePoint editform in a SharePoint modal after clicking the edit button at the end of each row. I can only make this work without the OpenPopUpPage. When I use OpenPopUpPage the {{row.entity.Id}} does not change to the row Id and as such results in a broken edit page.

Works:

{ displayName: 'Edit', cellTemplate: '<a ng-href="../lists/locations/editform.aspx?IsDlg=1&id={{row.entity.Id}}">Edit</a>' }

Opens the modal but with broken editform (not correct id):

{ displayName: 'Edit', cellTemplate: '<a ng-href="#" onclick="javascript:OpenPopUpPage(\'../lists/locations/editform.aspx?IsDlg=1&id={{row.entity.Id}}\')">Edit</a>' }
Это было полезно?

Решение

I don't know anything about sharepoint popups, but to pass a value to a function you should use this code:

    $scope.gridOptions = {
    data: 'myData',
    columnDefs: [{
      field: 'name',
      displayName: 'Name'
    }, {
      field: 'id',
      displayName: 'Action',
      cellTemplate: '<a ng-click="popup(row.entity.id)" href="#">Edit</a>'
    }]
    };

    $scope.popup = function(id) {
    // call your popup from here
    alert(id);
    }

Try this Plunker

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top