nhn / tui.grid

🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
http://ui.toast.com/tui-grid/
MIT License
2.42k stars 394 forks source link

defaultValue setting error #1785

Open jalim12 opened 2 years ago

jalim12 commented 2 years ago

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에만 값이 들어있음.

  5. Set defaultValue in grid columns. (artist, typeCode)
  6. Add 1 row data. (Add a value to name only)
  7. If you check the screen, one row has been added. Values ​​are shown in name, artist, and typeCode.
  8. 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):

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.

`

jajugoguma commented 1 year ago

Sorry for late replying.

Thanks for reporting a bug. I'll fix it!