tui.grid icon indicating copy to clipboard operation
tui.grid copied to clipboard

defaultValue setting error

Open jalim12 opened this issue 3 years ago โ€ข 0 comments

Describe the bug grid columns ์ •๋ณด์— defaultValue ์ง€์ • ์‹œ ํ™”๋ฉด์—๋Š” ๊ฐ’์ด ๋ณด์ด์ง€๋งŒ getData์— ๊ฐ’์ด ์—†์Šต๋‹ˆ๋‹ค. (getData์— ๊ฐ’์ด ๋“ค์–ด์žˆ์–ด์•ผ ํ•˜์ง€ ์•Š๋‚˜ ์‹ถ์Šต๋‹ˆ๋‹ค.)

When defaultValue is specified for grid columns information, the value is visible on the screen, but there is no value in getData. (I think getData should contain a value.)

To Reproduce

  1. grid columns์— defaultValue ์„ค์ •. (artist, typeCode)
  2. row data 1๊ฑด ์ถ”๊ฐ€. (name์—๋งŒ ๊ฐ’์„ ์ฃผ๊ณ  ์ถ”๊ฐ€)
  3. ํ™”๋ฉด ํ™•์ธํ•˜๋ฉด ํ–‰ 1๊ฐœ ์ถ”๊ฐ€๋˜์–ด์žˆ๊ณ  name, artist, typeCode์— ๊ฐ’์ด ๋ณด์ž„.
  4. grid.getData() ๋กœ ๊ฐ’ ํ™•์ธํ•˜๋Š” ๊ฒฝ์šฐ name์—๋งŒ ๊ฐ’์ด ๋“ค์–ด์žˆ์Œ.
  1. Set defaultValue in grid columns. (artist, typeCode)
  2. Add 1 row data. (Add a value to name only)
  3. If you check the screen, one row has been added. Values โ€‹โ€‹are shown in name, artist, and typeCode.
  4. When checking the value with grid.getData(), only name contains a value.

Expected behavior grid.getData() ๋กœ ๊ฐ’ ํ™•์ธํ–ˆ์„ ๋•Œ name, artist, typeCode์— ๊ฐ’์ด ๋“ค์–ด์žˆ์–ด์•ผ ํ•จ.

When the value is checked with grid.getData(), values โ€‹โ€‹must be included in name, artist, and typeCode.

Desktop (please complete the following information):

  • OS : window 11
  • Browser : chrome
  • version : 105.0.5195.127

Additional Context screenshot and source

image

`

const grid = new tui.Grid({
      el: document.getElementById('list'),
      scrollX: false,
      scrollY: false,
      columns: [
        {
          header: 'Name',
          name: 'name',
          editor: 'text'
        },
        {
          header: 'Artist',
          name: 'artist',
          editor: 'text',
          defaultValue: 'defaultValue1'
        },
        {
          header: 'Type',
          name: 'typeCode',
          formatter: 'listItemText',
          defaultValue: '2',
          editor: {
            type: 'select',
            options: {
              listItems: [
                { text: 'Deluxe', value: '1' },
                { text: 'EP', value: '2' },
                { text: 'Single', value: '3' }
              ]
            }
          }
        }
      ]
    });

let gridData = [{name: 'name1'}];
grid.resetData(gridData);

var rowData = grid.getData(); // [{name: 'name1', artist: null, typeCode: null, ...}] -> Name, artist, and typeCode must have values.

`

jalim12 avatar Sep 20 '22 03:09 jalim12