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

Is TUI Grid provides global configuration API? #1784

Closed noritersand closed 1 year ago

noritersand commented 2 years ago

Summary Is TUI Grid provides global configuration API?

Version latest

Hello, I'd like to inquire about TUI grid settings. Is there any 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. 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

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 commented 1 year ago

I'm sure that there are no global APIs except applyTheme() or setLanguage().