Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jordy van Eijk 7 posts 51 karma points
    Aug 20, 2014 @ 21:24
    Jordy van Eijk
    0

    Howto export custom data from backend to excel Umbraco 7

    Hi All,

    I'm having some problems with my custom tree i added to the backend. This tree shows some registrations that are saved inside the database (custom table no Umbraco table or ContentType/MediaType) I managed to show the information of the registration when i click the subnode which i will explain later.

    My registrations are for events and my tree looks like the following.

    • Event name 1
      • Registration 1
      • Registration 2
      • Registration 3
    • Event name 2
      • Registration 4
      • Registration 5
      • Registration 6
      • Registration 7 etc...

    I added an edit.html file to my backoffice map and a angular controller to catch the information when the item in the tree is clicked. It does this for every item in the tree Parent en Child nodes. Now there are some thing that im wondering how to fix.

    On right clicking on the parent node i want to have a menu option for exporting the data under that node. but when i left click this node it shows the same edit page as the subnodes how to disable this?

    on left clicking the subnode it shows my edit.html this is right.

    But now the tricky part i created the exportDocumentType.html for exporting the the underlying data of the event when i click export in backoffice it will show me the exportDocumentType.html which has only one button on it called export. i created the angular controller to and i attached the ng-click to my export function which will call the WebApi Controller.

    But non of this is happening and i'm lost on where to go now.

    I hope someone can help me.

    Here some code to make it all clear:

    View:

    <div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Content.CreateController">
    
    <div class="umb-pane">
        <h5>Exporteer alle aanmeldingen voor {{id}}</h5>
    
        <ul class="umb-actions umb-actions-child">
            <li>
                <a href="" ng-click="export()">exporteer</a>
            </li>
        </ul>
    </div></div><div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
    <button class="btn" ng-click="nav.hideDialog(true)">
        <localize key="buttons_somethingElse">Do something else</localize>
    </button>
    

    angular controller:

    angular.module("umbraco").controller("Aanmeldingen.AanmeldingenTree.ExportDocumentTypeController",
    
    function ($scope, $routeParams, AanmeldingenResource, notificationsService, appState) {
        $scope.id = $routeParams.id;
        $scope.export = function ()
        {
            AanmeldingenResource.exportByEventName($routeParams.id);
        };
    });
    

    ...resource.js:

    angular.module("umbraco.resources").factory("AanmeldingenResource", function ($http) {
    return {
        getById: function (id) {
            return $http.get('backoffice/Aanmeldingen/AanmeldingenApi/GetAanmeldingById?id=' + id);
        },
    
        //exportXls: function (id) {
        //    return $http.get('backoffice/Aanmeldingen/AanmeldingenApi/Export?name=' + id);
        //},
    
        exportByEventName: function (name) {
            debugger;
            return $http.get('backoffice/Export/ExportApi/ExportToExcel?evenementNaam=' + name);
        }
    };});
    
Please Sign in or register to post replies

Write your reply to:

Draft