! 제품 버전을 정확하게 입력해 주세요.
제품 버전이 정확하게 기재되어 있지 않은 경우,
최신 버전을 기준으로 안내 드리므로
더욱 빠르고 명확한 안내를 위해
제품 버전을 정확하게 입력해 주세요!

그룹화 관련해서 문의 드립니다. > Q&A | 토론

본문 바로가기

VueJS 그룹화 관련해서 문의 드립니다.

페이지 정보

작성자 ty90do 작성일 2023-11-02 20:05 조회 234회 댓글 0건
제품 버전 : 최신버전
컨트롤 이름 : 위즈모 그룹화

본문

wijmo grid에서 그룹화를 했을때 item count에 따라 1개 일때는 그룹화를 하지 않고 보일수 있도록 하는 방법 및 셈플 소스좀 알려주시면 감사하겠습니다.

참고로  아래처럼 1개 일때는 group화를 한게 펼쳐 지지 않은상태로 보였으면 하는데 해당 부분도 같이 할수 있도록 부탁 드립니다.

특히 vue로 셈플 소스 부탁 드립니다.(해당 부분을 찾아봐도 없는것 같아서.. 어떻게 해야 하는지 잘 모르겠네요...)


 

Source

<template>
  <div class="container-fluid">
      <wj-flex-grid
          :itemsSource="wijmoView" :initialized="initializedGrid">
          <wj-flex-grid-column binding="id" header="ID" :width="60" :isReadOnly="true" />
          <wj-flex-grid-column binding="country" header="Country" />
          <wj-flex-grid-column binding="product" header="Product" />
          <wj-flex-grid-column binding="sales" header="Sales" aggregate="Sum" />
          <wj-flex-grid-column binding="expenses" header="Expenses" aggregate="Sum" />
          <wj-flex-grid-column binding="profit" header="Profit" :dataType="2" :isReadOnly="true" :allowSorting="false" />
      </wj-flex-grid>
      <button @click="search()">search</button>
  </div>
</template>

<script>
import "@grapecity/wijmo.styles/wijmo.css";
import "bootstrap.css";
import Vue from "vue";
import "@grapecity/wijmo.vue2.grid";
import * as wjcGrid from '@grapecity/wijmo.grid';
import * as wjcCore from '@grapecity/wijmo';
import { getData } from "./data";

new Vue({
  el: "#app",
  data: function() {
    return {
        data: new wjcCore.CollectionView(getData(), {
            groupDescriptions: [
                new wjcCore.PropertyGroupDescription('Grand Total'
                    () => {
                        return '';
                    }),
                'country'
            ]
        }),
        wijmoGrid: null,
        wijmoView: null,
    };
  },
  methods:{
    initializedGrid(flex){
        this.wijmoGrid = flex;
    },
    search() {
        this.wijmoView = new wjcCore.CollectionView(getData());
        const gd = new wjcCore.PropertyGroupDescription('Grand Total', () => {
                        return '';
                    });
        this.wijmoView.groupDescriptions.push(gd);
        const gd1 = new wjcCore.PropertyGroupDescription('country');
        this.wijmoView.groupDescriptions.push(gd1);
        this.wijmoGrid.formatItem.addHandler((s, e) => {
            // cells and column footer panels only
            if (e.panel == s.cells) {
                // get row, column, and data item (or group description)
                let r = s.rows[e.row],
                    c = s.columns[e.col],
                    item = s.rows[e.row].dataItem,
                    group = r instanceof wjcGrid.GroupRow ? item : null,
                    negative = false// assume value is not negative
                // calculate profit
                if (c.binding == 'profit') {
                    let profit = group
                        ? group.getAggregate('Sum''sales') - group.getAggregate('Sum''expenses')
                        : item.sales - item.expenses;
                    e.cell.textContent = wjcCore.Globalize.format(profit, c.format);
                    negative = profit < 0;
                }
                // update 'negative' class on cell
                wjcCore.toggleClass(e.cell, 'negative', negative);
            }
        });
        this.wijmoView.refresh();
    },
  }
});
</script>

<style>
  .wj-flexgrid {
    max-height: 250px;
    margin: 10px 0;
  }
  .wj-cell.wj-frozen-row {
      border-bottom: none;
  }
  .negative {
    color: red;
  }
  body {
    margin-bottom: 20px;
  }
</style>
  • 페이스북으로 공유
  • 트위터로  공유
  • 링크 복사
  • 카카오톡으로 보내기

댓글목록

등록된 댓글이 없습니다.

1 답변

VueJS Re: 그룹화 관련해서 문의 드립니다.

추천0 이 글을 추천하셨습니다 비추천0

페이지 정보

작성자 MESCIUS루시 작성일 2023-11-07 17:24 댓글 0건

본문

안녕하세요 메시어스입니다.


문의하신 내용과 관련하여 답변드립니다.


1. 그룹행 숨기기

=> 해당 기능의 경우, formatItem 이벤트 내에서 자식 행 수 체크 후, 행 visible 설정을 통해 구현할 수 있습니다. (샘플의 경우, id가 1과 2에 대한 그룹행을 숨김처리했습니다.)


2. 그룹행 접기 및 아이콘 숨기기

=> 그룹행 접기 기능의 경우도 동일하게 formatItem 이벤트 내에서 자식 행 수 체크 후, 행 isCollapsed 설정을 통해 구현할 수 있습니다. 접기/펼치기 아이콘의 경우, 요소에 접근하여 display를 none으로 설정해주시면 됩니다.


아래 간단한 샘플 참고 부탁드립니다.


더불어 데모에 나와있지 않는 기능의 경우, 일반적으로 API 문서 확인 및 코드단에서 사용자 정의를 해주셔야 하며 이점 업무에 참고 부탁드립니다.



- isCollapsed API 문서

- visible API 문서


관련 API 문서를 공유드리며 다른 궁금한 점이 생기면 문의주시기 바랍니다.


감사합니다.

메시어스 드림

댓글목록

등록된 댓글이 없습니다.

메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기
메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기
이메일 : sales-kor@mescius.com | 전화 : 1670-0583 | 경기도 과천시 과천대로 7길 33, 디테크타워 B동 1107호 메시어스(주) 대표자 : 허경명 | 사업자등록번호 : 123-84-00981 | 통신판매업신고번호 : 2013-경기안양-00331 ⓒ 2024 MESCIUS inc. All rights reserved.