2016-06-29 2 views
3

검도 UI 웹 사이트의 예제를 정확히 따라했습니다. 모든 데이터는 괜찮지 만 "합계"연산은 일어나지 않습니다. 따라서 groupFooterTemplate에서 모든 열은 "평균"열을 포함하여 표의 마지막 항목을 표시합니다. 나는 며칠 동안이 일을 해왔고 무엇이 잘못되었는지를 알 수 없다. 이 문제가 누구에게 발생 했습니까? 데이터 소스 ID와 같은 열을 기준으로검도 UI 그리드 집계 "sum"이 작동하지 않습니다.

$scope.vmResyncGridOptions = { 
    dataSource: { 
     data: $scope.vmDataSource, 
     scheme: { 
       model: { 
        id: "vmName", 
        fields: { 
         vmName: { type: "string" }, 
         vdiskName: { type: "string" }, 
         total: { type: "number" }, 
         synced: { type: "number" }, 
         percent: { type: "number" } 
        } 
      } 
     }, 
     group: { 
      field: "vmName", 
      aggregates: [ 
       { field: "vdiskName", aggregate: "count" }, 
       { field: "total", aggregate: "sum" }, 
       { field: "synced", aggregate: "sum" }, 
       { field: "percent", aggregate: "average" } 
      ] 
     }, 
     aggregate: [ 
      { field: "vdiskName", aggregate: "count" }, 
      { field: "total", aggregate: "sum" }, 
      { field: "synced", aggregate: "sum" }, 
      { field: "percent", aggregate: "average" } 
     ] 
     }, 
     sortable: false, 
     scrollable: true, 
     pageable: true, 
     groupable: true, 

     //height: ($scope.screenHeight-110)*0.70-8, 
     columns: [ 
      { 
       field: "vdiskName", 
       title: $scope.translation.Resync_Table_VDisk_Name, 
       aggregates: ["count"], 
       groupFooterTemplate: "Count: #=count#" 
      }, 
      { 
       field: "total", 
       title: $scope.translation.Resync_Table_Total_Bytes, 
       aggregates: ["sum"], 
       groupFooterTemplate: "Total: #=sum#" 
      }, 
      { 
       field: "synced", 
       title: $scope.translation.Resync_Table_Has_Resynced, 
       aggregates: ["sum"], 
       groupFooterTemplate: "Total Resynced: #=sum#" 
      }, 
      { 
       field: "percent", 
       title: $scope.translation.Resync_Table_VDisck_Completed, 
       aggregates: ["average"], 
       groupFooterTemplate: "Percent: #=average#" 
      } 
     ] 
    }; 
+0

집계 '개수'는 정상적으로 작동하지만 합법적이지 않고 평균값이 아닙니다. – Patricia

+0

count는 모든 필드 또는 데이터 유형에서 작동하지만 합계 및 평균은 숫자에만 적용됩니다. tofixed 또는 + 또는 어떤 함수가이 문제를 해결하기 위해 –

+0

두 번째 기회를 주조하여 변수를 수정하고 다른 유형으로 변경할 수 있습니다. 문제는 aggregartes가 아니라 ** footerTemplate **입니다. 그런 다음 ** groupHeaderTemplate **에 관심을 갖고 프로젝트 요구 사항이 무엇인지 –

답변

0

당신 그룹 :

  id: "vmName", 
        fields: { 
         vmName: { type: "string" }, 
         vdiskName: { type: "string" }, 
         total: { type: "number" }, 
         synced: { type: "number" }, 
         percent: { type: "number" } 
        } 
      } 
     }, 
     group: { 
      field: "vmName", 

그게 당신이 합계와 평균을하지 않는 이유.

관련 문제