首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >智能表中的行选择不能工作。

智能表中的行选择不能工作。
EN

Stack Overflow用户
提问于 2017-03-30 08:29:47
回答 1查看 1.9K关注 0票数 0

我无法使用智能表选择行。我添加了JSON和HTML。打开模态窗口的代码

$scope.getSerialData =函数(){

代码语言:javascript
运行
复制
    var serialNo ='700001117961';// $scope.asupFormData.asup_serial_no;
    $http({
                method: 'GET',
                url: getAsupSerialData+serialNo+'/',            
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                } // set the headers so angular passing info as form data (not request payload)
            }).success(function(data) {
                $scope.rowCollection1 = JSON.parse(data);
                $scope.rowCollection = $scope.rowCollection1.result;

                console.log($scope.rowCollection)
            }).error(function(data){

            });

    $scope.close = function() {
        uibModalInstance.dismiss('cancel');
    };  

    $scope.saveForms = function(){      

    uibModalInstance.dismiss('cancel');
    }

    var uibModalInstance = $uibModal.open({
        templateUrl: 'asupsearchform.html/',            
        scope: $scope,

        controller:'MainCtrl',
        windowClass: 'device-modal-window'
    });
}   

rowCollection

代码语言:javascript
运行
复制
[["2017032517580346","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200373","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200372","HA Group Notification (WEEKLY_LOG) NOTICE"]]

$scope.getSerialData正在从某个打开模态窗口的链接中被调用

HTML

代码语言:javascript
运行
复制
<table st-table="rowCollection" class="table" >
<thead>
<tr>
    <th st-sort="firstName">ID</th>
    <th st-sort="lastName">Title</th>   
</tr>
</thead>
<tbody>
<tr  st-select-row="row" st-select-mode="multiple" ng-repeat="row in rowCollection" ng-click="doSomeStuffToSelected(row)">
    <td>{{row[0]}}</td>
    <td>{{row[2]}}</td>


</tr>
</tbody>
</table>

帮帮忙吧。使用静态代码选择时,当我在modalwindow下使用它时,就会发生fine.This。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-30 09:34:15

您需要为.st-selected定义样式

代码语言:javascript
运行
复制
<style>
  .st-selected{
    background: #216eff !important;
    color: white !important;
  }
</style>

在您的rowCollection值中,子数组中的位置为0和1,而您使用的是位置0和位置2。

代码语言:javascript
运行
复制
 <td>{{row[0]}}</td>
 <td>{{row[2]}}</td>

这是工作演示

编辑:使用模式的演示

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43112425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档