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

input date, grid 그룹 등 몇가지 문의 사항 > Q&A | 토론

본문 바로가기

VueJS input date, grid 그룹 등 몇가지 문의 사항

페이지 정보

작성자 ty90do 작성일 2023-10-21 15:20 조회 309회 댓글 0건
제품 버전 : 최신버전
컨트롤 이름 : input date, grid

본문

1. input date 달력관련해서 format을 월로 하고 selection mode를 월로 해서 했는데 화면에서 변경할때는 format이 년월로 해서 나오는데, 값을 강제로 다른 값으로 변경하고 나니 년월일이 나오네요.. 실제 값은 년월일인데 selection mode/format이 년월이여서 화면에도 년월로 표시되는것 같습니다.

질문은 값을 강제로 변경했을때 년월일이 나오는데 이게 왜 그런지 모르겠네요. 

date선택할때 년월일이 나와서 날짜(일)까지 선택하는것으로 화면이 나오고 있습니다. 

해당 부분에 initgrid에서 처럼 강제로 년월이 나오도록 변경할 수 있는 방법좀 알려주시면 감사하겠습니다.



소스

<template>
    <div class="container-fluid">
        <div class="form-group">
            <label for="theInputDate">InputDate</label>
            <wj-input-date id="theInputDate" :initialized='initInputDate'  :value="value" :format="'yyyyMM'">
            </wj-input-date>
        </div>
        <button @click="changeValue()">change</button>
    </div>
</template>

<script>
    import 'bootstrap.css';
    import '@grapecity/wijmo.styles/wijmo.css';
    import Vue from 'vue';
    import '@grapecity/wijmo.vue2.core';
    import '@grapecity/wijmo.vue2.input';

    let App = Vue.extend({
        name: 'app',
        data: function () {
            let curr = new Date();
            return {
                firstDay: new Date('202209'),
                lastDay: new Date('202311'),
                inputDateGrid: null,
                value: new Date(),
            }
        },
        methods: {
            onValueChanged: function(s){
                this.value = s.value;
            },
            initInputDate: function(s) {
                this.inputDateGrid = s;
                this.inputDateGrid.selectionMode = 2;
            },
            changeValue: function(){
                this.value = new Date('202209');
            },
        },
    })

    let vm = new Vue({ render: h => h(App) }).$mount('#app');
</script>

<style>
    label {
        width: 120px;
        text-align: right;
        margin-right: 3px;
    }

    body {
        margin-bottom: 24px;
    }
</style>
 

2. wijmo grid에서 그룹화를 했을때 보통 binding/header에 설정된 이름으로 나오도록 되어 있는데 혹시 binding은 변경안하더라도 header를 변경해서 group을 할수 있을까요(Grid에 나오는 컬럼 Header는 바꾸지 않고 밑에 group하는 부분에서만 Header를 변경하고 싶습니다.)? 아래 소스에서 변경할 수 있는지 확인 부탁 드립니다.( ex) Country:US(34items) -> TEST:US(34items) )

소스

<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: input date, grid 그룹 등 몇가지 문의 사항

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

페이지 정보

작성자 GCK루시 작성일 2023-10-25 16:17 댓글 0건

본문


안녕하세요 그레이프시티입니다.


문의하신 내용에 대해 답변 드립니다.


1. inputDate의 value 설정 문의

=> 문의하신 내용의 경우, new Date 메서드에 올바른 인자 값을 전달하지 않아 나타난 현상으로 보입니다. 관련하여 유효한 인자값을 전달하면 올바르게 변경 처리되오니 확인 부탁드립니다.


2. 그룹 헤더의 값을 변경 문의

=> 그룹 헤더 값을 임의로 변경하고 싶으신 경우에는 formatItem을 이용하여 사용자 정의해보시기 바랍니다.

theGrid.formatItem.addHandler(function(s,e){
       if (e.panel == s.cells) { // 셀 영역
         if(s.rows[e.row] instanceof wjGrid.GroupRow){ // 그룹 헤더인지 확인
        // 셀 요소 수정
      }
    }
  })


다른 궁금한 점이 생기면 문의주시기 바랍니다.


감사합니다.

그레이프시티드림

댓글목록

등록된 댓글이 없습니다.

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