Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › Data values
- This topic has 7 replies, 3 voices, and was last updated 1 year, 11 months ago by
Markov.
-
AuthorPosts
-
December 14, 2023 at 5:41 pm #109315
tbettinazzi@axioma.it
ParticipantIn standard html is possible to add “custom” attributes to tags using “data-xxxxxx” notation.
This kind of attibutes can then be read to customize the behaviour (e.g. make not visible all elemente having data-visible = 0).
Is it possible to use the same approach on smart elements ?
How can they be added ? and how can they be read ?
Tks
December 14, 2023 at 10:02 pm #109318ivanpeevski
ParticipantHi,
You can use data attributes on our components in the same way you would for any other html element. Like this:
let grid = document.querySelector(‘smart-grid’);
grid.dataset.customData = “abc”;
console.log(grid.dataset.customData);Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/December 15, 2023 at 11:33 am #109322tbettinazzi@axioma.it
ParticipantDataset is not described in API or, at least, I didn’t find it.
Could you provide a link for the explanation of such property ?
Tks
-
This reply was modified 1 year, 11 months ago by
tbettinazzi@axioma.it.
December 15, 2023 at 3:25 pm #109325ivanpeevski
ParticipantHi,
It’s not described in the API, because this is a property all HTML elements have.
You can see the documentation here – https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/December 16, 2023 at 8:09 am #109327tbettinazzi@axioma.it
ParticipantIs it possible to use custom data also on grid columns and cells ?
E.G. can I add a data (say data-visible) as a property to a grid colum and read it with js ?
And with grid cells ?
Tks
December 18, 2023 at 6:49 am #109332Markov
KeymasterHi,
No, this would not be possible with the current API. However, we already have a ‘visible’ property in the column which you can get/set with JS – const visible = grid.columns[0].visible;
Best Regards,
MarkovSmart UI Team
https://www.htmlelements.com/December 18, 2023 at 8:04 am #109343tbettinazzi@axioma.it
ParticipantI knew the visible property but in order to make a column visible or not with that property I need to identify at runtime columns which should be visible or not.
A custom property, if any, could be a good solution to identify them.
Tks
December 18, 2023 at 11:18 am #109346Markov
KeymasterHi,
At runtime you can also get/set it.
-
This reply was modified 1 year, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.