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

Is TUI Grid provides global configuration API?

Open noritersand opened this issue 3 years ago β€’ 0 comments

Summary Is TUI Grid provides global configuration API?

Version latest

μ•ˆλ…•ν•˜μ„Έμš”. TUI Grid μ„€μ • κ΄€λ ¨ 문의 λ“œλ¦½λ‹ˆλ‹€. (μ˜μ•Œλͺ»μ΄λΌ ν•œκ΅­μ–΄μ™€ λ³‘κΈ°ν•©λ‹ˆλ‹€)
Hello, I'd like to inquire about TUI grid settings.

μƒˆλ‘œ μƒμ„±λ˜λŠ” κ·Έλ¦¬λ“œ μΈμŠ€ν„΄μŠ€μ— μžλ™μœΌλ‘œ μ μš©λ˜λŠ” μ „μ—­ μ„€μ • APIλŠ” λ”°λ‘œ μ œκ³΅λ˜μ§€ μ•Šλ‚˜μš”?
Is there a global setup API that automatically applies to the newly created grid instance?

ν˜„μž¬λŠ” μ•„λž˜μ²˜λŸΌ:
Currently, it should be used as follows:

const grid = new Grid({
  // ...,
});

grid.on('click', () => {
  console.log('clicked!!');
})

각각의 μΈμŠ€ν„΄μŠ€μ— 맀번 이벀트 ν•Έλ“€λŸ¬λ₯Ό ν• λ‹Ήν•΄μ•Ό ν•˜λŠ”λ°μš”. I have to assign an event handler to each instance each time.

λ§Œμ•½ μ΄λ²€νŠΈμ— λŒ€ν•΄ μ „μ—­μ μœΌλ‘œ ν• λ‹Ήν•  ν•¨μˆ˜κ°€ μžˆλŠ” 경우, μ•„λž˜μ— μ˜ˆμ‹œλ‘œ μž‘μ„±ν•œ 것 같은 APIκ°€ μžˆλŠ”μ§€ μ•Œκ³  μ‹ΆμŠ΅λ‹ˆλ‹€:
If there is a function to be assigned globally for the event, I would like to know if there is an API as an example below:

Grid.global.configs({
  eventHandler: {
    click: () => {
      console.log('clicked!!');
    }
  }
})

const grid = new Grid({
  /// ...,
}); // Now this instance already has click event handler

이해λ₯Ό 돕기 μœ„ν•΄ 예λ₯Ό ν•˜λ‚˜ 더 λ“€λ©΄, 비동기 톡신 라이브러리인 Axiosμ—μ„œλŠ” λ‹€μŒμ²˜λŸΌ μ „μ—­ μ„€μ • APIλ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€:
To help explain, I add one more example. Axios provides a global setup API as follows:

axios.defaults.baseURL = 'https://api.example.com';
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

let response = await axios.get();

// ...

μ΄μƒμž…λ‹ˆλ‹€. κ°μ‚¬ν•©λ‹ˆλ‹€.
That's all. Thank you.

noritersand avatar Sep 20 '22 02:09 noritersand