Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
角度数据表中绑定的AngularJS模板未更改_Angularjs_Angular Datatables - Fatal编程技术网

角度数据表中绑定的AngularJS模板未更改

角度数据表中绑定的AngularJS模板未更改,angularjs,angular-datatables,Angularjs,Angular Datatables,我使用的角度数据表从下面的链接 我在这里使用延迟渲染概念 我有两个按钮 活动(当用户状态为1时显示) 非活动(当用户状态为0时显示) 因为双向数据绑定在这里不起作用。单击active&viceversa后,我无法显示非活动按钮 下面是我的代码 $scope.setCustomers = function (s, dto, dtc, f, c, h, t) { s.dtInstance = {}; s.actions = {}; //dtOptions - Makes

我使用的角度数据表从下面的链接

我在这里使用延迟渲染概念

我有两个按钮

  • 活动(当用户状态为1时显示)
  • 非活动(当用户状态为0时显示)
  • 因为双向数据绑定在这里不起作用。单击active&viceversa后,我无法显示非活动按钮

    下面是我的代码

     $scope.setCustomers = function (s, dto, dtc, f, c, h, t) {
        s.dtInstance = {};
        s.actions = {};
        //dtOptions - Makes the ajax request to get the customer records, also builds the buttons to copy,csv,excel..etc
        s.dtOptions = dto.fromSource('customers/showCustomers.json')
                .withPaginationType('full_numbers')
                .withDisplayLength(25)
                .withOption('createdRow', createdRow)
                .withDOM('<"html5buttons"B>lTfgitp').withDisplayLength(25);
    
        // dtColumns - Builds the columns and renders the rows for each column
        s.dtColumns = [
            dtc.newColumn('name').withTitle('Name'),
            dtc.newColumn('email').withTitle('Email'),
            dtc.newColumn('phone').withTitle('Phone'),
            dtc.newColumn('status').withTitle('Status')
                    .renderWith(function (data) {
                        return  "<div style=text-align:center;>" + (data == 1 ? 'Accepted' : data == 2 ? 'Declined' : 'Pending') + "</div>";
                    }),
            dtc.newColumn(null).withTitle('Actions').notSortable()
                    .renderWith(actionsHtml)
        ];
        function createdRow(row, data, dataIndex) {
            c(angular.element(row).contents())(s);
        }
        function actionsHtml(data, type, full, meta) {
            s.actions[data.id] = data;
            var actions = '<button ladda="loadingDemo' + data.customer_id + '" class="ladda-button ladda-button-demo btn btn-primary btn-xs" data-style="zoom-in" ng-click="resetPassword(actions[' + data.id + '])" uib-tooltip="Reset Password" tooltip-placement="top"><i class="fa fa-key"></i></button>&nbsp;'
                    + '<a href="#/customers/viewBalance/' + data.unique_id + "/" + data.customer_id + '" ><button class="btn btn-info btn-xs" uib-tooltip="Transaction History" tooltip-placement="top"><i class="fa fa-money"></i></button></a>&nbsp;'
                    + '<a href="#/invoices/view-invoice/' + data.unique_id + '" ><button class="btn btn-info btn-xs" uib-tooltip="View Orders"><i class="fa fa-files-o"></i></button></a>&nbsp;'
                    + '<a href="#/customers/view-customer/' + data.uniq_id + '" ><button type="button" class="btn btn-primary btn-xs" tooltip-placement="top" uib-tooltip="View Profile"><i class="fa fa-eye"></i></button></a>&nbsp;'
                    + '<a href="#/customers/add-customer/step-one/' + data.uniq_id + '" ><button class="btn btn-success btn-xs" tooltip-placement="top" uib-tooltip="Edit"><i class="fa fa-pencil"></i></button></a>&nbsp;';
            if (data.is_active == 1) {
                actions += '<button class="btn btn-success btn-xs" data-is_active="' + data.is_active + '" ng-click="setStatus(actions[' + data.id + '])" tooltip-placement="top" uib-tooltip="Inactive"><i class="fa fa-thumbs-up"></i></button>&nbsp;';
            } else {
                actions += '<button class="btn btn-danger btn-xs"  data-is_active="' + data.is_active + '" ng-click="setStatus(actions[' + data.id + '])" tooltip-placement="top" uib-tooltip="Active"><i class="fa fa-thumbs-down"></i></button>&nbsp;';
            }
    
            return actions;
        }
    }
    $scope.setCustomers($scope, DTOptionsBuilder, DTColumnBuilder, $filter, $compile, $http, toaster);
    
    $scope.setCustomers=功能(s、dto、dtc、f、c、h、t){
    s、 dtInstance={};
    s、 动作={};
    //dtOptions-发出ajax请求以获取客户记录,还构建复制、csv、excel等按钮
    s、 dtOptions=dto.fromSource('customers/showCustomers.json')
    .withPaginationType('完整编号')
    .带显示长度(25)
    .withOption('createdRow',createdRow)
    .withDOM('lTfgitp')。withDisplayLength(25);
    //dtColumns—为每列生成列并呈现行
    s、 dtColumns=[
    dtc.newColumn('name')。带标题('name'),
    dtc.newColumn('email')。带标题('email'),
    dtc.newColumn('phone')。带标题('phone'),
    dtc.newColumn('status')。带标题('status'))
    .renderWith(功能(数据){
    返回“”+(数据==1?“已接受”:数据==2?“已拒绝”:“待定”)+“”;
    }),
    dtc.newColumn(null).withTitle('Actions').notSortable()
    .renderWith(actionsHtml)
    ];
    函数createdRow(行、数据、数据索引){
    c(angular.element(row.contents())(s);
    }
    函数actionsHtml(数据、类型、完整、元){
    s、 动作[data.id]=数据;
    变量操作=“”
    + ' '
    + ' '
    + ' '
    + ' ';
    如果(data.is_active==1){
    行动+=”;
    }否则{
    行动+=”;
    }
    返回动作;
    }
    }
    $scope.setCustomers($scope、DTOptionsBuilder、DTColumnBuilder、$filter、$compile、$http、toaster);
    
    谢谢

    使用更改按钮。加载单元格时,模板仅编译一次。请使用更改按钮。加载单元格时,模板只编译一次。