Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #109315

    In 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

    #109318
    ivanpeevski
    Participant

    Hi,

     

    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/

    #109322

    Dataset 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

    #109325
    ivanpeevski
    Participant

    Hi,

     

    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/

    #109327

    Is 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

    #109332
    Markov
    Keymaster

    Hi,

    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,
    Markov

    Smart UI Team
    https://www.htmlelements.com/

    #109343

    I 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

    #109346
    Markov
    Keymaster

    Hi,

    At runtime you can also get/set it.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.