本帖最后由 QQximen 于 2021-7-20 19:34 编辑
可以参考其它同行或同类产品!是可以参与别人的!然后实现需求不要浪费时间在找故事上面了!这样的话10年也搞不定这个交叉表!这个弄出来真的不是一般的功能!希望胡老板重视一下!这么多大佬提了这么多了!!然后google上面可以找到的什么付费的什么免费的可以大家帮忙找一下!然后看一下哪个适合你们的架构的
Javascript Pivot Table Builder for ASP.NET
http://webpivot.nrecosite.com/
这个是动态的交叉表是否可以在这个上面进行优化呢?
PivotTable.js是一个开源的 Javascript 数据透视表(又名 Pivot Grid、Pivo​​t Chart、Cross-Tab)实现,具有拖放功能,由Nicolas Kruchten 编写。
参与:
https://stackoverflow.com/questions/36600179/angular-bind-table-to-cross-data
- $scope.findMatch = function(beer, characteristic) {
- return $scope.crossData.filter(function(data) {
- return data.beerId === beer.id && data.characteristicId === characteristic.id
- })[0];
- }
- Working code snippet:
- var app = angular.module('plunker', []);
- app.controller('MainCtrl', function($scope) {
- $scope.beers = [
- { id: 27, description: "Hopslam Ale" },
- { id: 28, description: "Founders Kentucky Breakfast Stout" },
- { id: 29, description: "Zombie Dust" } ];
-
- $scope.characteristics = [
- { id: 3, description: "ABV" },
- { id: 4, description: "IBU" },
- { id: 5, description: "Calories" },
- { id: 6, description: "Reviews"}];
-
- $scope.crossData = [
- { beerId: 27, characteristicId: 3, value: 10 },
- { beerId: 27, characteristicId: 4, value: 70 },
- { beerId: 27, characteristicId: 5, value: 300 },
- { beerId: 27, characteristicId: 6, value: 3419 },
- { beerId: 28, characteristicId: 3, value: 11 },
- { beerId: 28, characteristicId: 4, value: 70 },
- { beerId: 28, characteristicId: 5, value: 336 },
- { beerId: 28, characteristicId: 6, value: 2949 },
- { beerId: 29, characteristicId: 3, value: 6 },
- { beerId: 29, characteristicId: 4, value: 50 },
- { beerId: 29, characteristicId: 5, value: 186 },
- { beerId: 29, characteristicId: 6, value: 1454 }];
-
- $scope.name = 'Stack Overflow friends';
- $scope.findMatch = function(beer, characteristic) {
- return $scope.crossData.filter(function(data) {
- return data.beerId === beer.id && data.characteristicId === characteristic.id
- })[0];
- }
- });
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
- <body ng-app="plunker" ng-controller="MainCtrl">
- <p>Hello {{name}}!</p>
- <br />
- <table class="table table-striped">
- <thead>
- <tr>
- <th>#</th>
- <th ng-repeat="char in characteristics">
- {{ char.description }}
- </th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="beer in beers">
- <td>{{ beer.description }}</td>
- <td ng-repeat="char in characteristics">
- {{findMatch(beer, char).value}}
- </td>
- </tr>
- </tbody>
- </table>
- </body>
复制代码 是否可以做一个参考上面的这个案例已经 绑定了数据!如果增加一个事件或者能触发保存与填写是不是就可以了呢?
|