Op dinsdag 27 mei 2014 10:29:50 UTC+2 schreef OneOnlyUrl:
>
> He,
>
> Thx for all the tips but I dont think that is the problem. I tried to 
> create the issue on plunker but everything is working fine there: 
> http://plnkr.co/edit/NvkFuA6QwV6oNGJ4iLzz?p=preview
>
> I think my problems is the data array but I dont know what, so here is all 
> my code relevant for this and I hope some of you guys can help:
>
>
            <!-- Table -->
            <div id="server-overview-container">
            <div class="table-responsive">
                <table id="dataTable" class="table table-striped 
table-hover">
                    <thead>
                        <tr>
                            <th ng-repeat="(key, value) in data[0]" 
repeat-done="fixedTableHeaders()"
                            sort-table-head by="order" reverse="reverse" 
order="'ipv4'">
                            {{ key }} 
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in data  | orderBy:order:reverse 
| filter:searchText" ng-click="rowClickHandler(row)">               
                            <td ng-repeat="(varName, value) in row">
                            {{ value }}  
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            </div>


/**
 * Sortable table headers with icons, font for icons:FontAwesome.
 */
(function(ng) {
    'use strict';
    var module = ng.module('sortTableHead', []);

    module.directive('sortTableHead', [

        function() {
            return {
                restrict: 'A',
                transclude: true,
                template: '<th class="selectable" data-ng-click="onClick()" 
>' +
                    '<span ng-transclude class="pull-left"></span>' +
                    '<i class="fa fa-sort pull-right" 
data-ng-class="{\'fa-sort-desc\' : order === by && !reverse, 
 \'fa-sort-asc\' : order === by && reverse, \'fa-sort\': !order === 
by}"></i>' +
                    '</th>',
                scope: {
                    order: '=',
                    by: '=',
                    reverse: '='
                },
                link: function(scope) {
                    scope.onClick = function() {
                        if (scope.order === scope.by) {
                            scope.reverse = !scope.reverse;
                        } else {
                            scope.by = scope.order;
                            scope.reverse = false;
                        }
                    }
                }
            }
        }
    ]);
})(angular);



koekoek.controller('serversOverviewController', function($scope, $http, 
$location) {
 $scope.rowClickHandler = function(rowData) {
var selectedRowIp = rowData.ipv4;
$location.path('/overview/' + selectedRowIp);
};

$http.get('server/serverList').success(function(data) {
$scope.data = data;
});
 $scope.fixedTableHeaders = function(){
var $table = $("#dataTable");
$table.floatThead({
useAbsolutePositioning: true
});
$table.floatThead('reflow');
};
}); 
 


>
>
>
> Op maandag 26 mei 2014 17:02:09 UTC+2 schreef OneOnlyUrl:
>>
>> I am using a angular directive for sorting my table headers. But it seems 
>> that the html cannot reach the variables in my isolated directive scope and 
>> I cant seem what i am doing wrong. So i hope one of you guys can help me.
>>
>> also posted it here: 
>> http://stackoverflow.com/questions/23872804/sort-table-header-directive-cant-get-scope-attributes
>>
>> Can anyone help me? Or see what the issue is?
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to