tui.grid
tui.grid copied to clipboard
Is TUI Grid provides global configuration API?
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.