smart-table 中的行选择不起作用
Row selection in smart-table is not working
我无法使用 smart-table select 行。我添加了 JSON 和 HTML。
打开模式的代码 window
$scope.getSerialData = 函数(){
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
是
[["2017032517580346","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200373","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200372","HA Group Notification (WEEKLY_LOG) NOTICE"]]
$scope.getSerialData 被一些 link 调用,这会打开一个模式 window
HTML
<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>
请帮忙。使用静态代码 selection 正在工作 fine.This 当我在模态 window
下使用它时正在发生
您需要为 .st-selected
定义样式
<style>
.st-selected{
background: #216eff !important;
color: white !important;
}
</style>
此外,在您的 rowCollection
中,值位于子数组中的位置 0 和 1,而您使用的是位置 0 和 2
<td>{{row[0]}}</td>
<td>{{row[2]}}</td>
这里是WORKING DEMO
编辑:Demo 使用模态
我无法使用 smart-table select 行。我添加了 JSON 和 HTML。 打开模式的代码 window
$scope.getSerialData = 函数(){
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
是
[["2017032517580346","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200373","HA Group Notification (WEEKLY_LOG) NOTICE"],
["2017031818200372","HA Group Notification (WEEKLY_LOG) NOTICE"]]
$scope.getSerialData 被一些 link 调用,这会打开一个模式 window
HTML
<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>
请帮忙。使用静态代码 selection 正在工作 fine.This 当我在模态 window
下使用它时正在发生您需要为 .st-selected
<style>
.st-selected{
background: #216eff !important;
color: white !important;
}
</style>
此外,在您的 rowCollection
中,值位于子数组中的位置 0 和 1,而您使用的是位置 0 和 2
<td>{{row[0]}}</td>
<td>{{row[2]}}</td>
这里是WORKING DEMO
编辑:Demo 使用模态