@hughbluegmail-com
@hughbluegmail-com
Forum Replies Created
-
AuthorPosts
-
December 19, 2022 at 6:09 pm in reply to: document.querySelector typings fail when use smart.grid.d.ts #104138Hugh AndersonParticipant
I discovered a workaround which i don’t think i should have to do
(document as ParentNode).querySelectorAll(...)
<div></div>
<div>I don’t think it should be necessary to cast document like that. But at least I am unblocked. What can we do about typings of this lib overwriting the real typings of Document?</div>Hugh AndersonParticipantI think I can use the window.Smart(element, class { properties = properties }) pattern but I need to pass an element directly, instead of a string of the element’s id there. Because my stencil’s component is already in the shadow dom, when I pass an id in a string to the first parameter of window.Smart(‘#myGridId’) it cannot be found because it is not in the dom it is in my component’s shadow dom. But I can easily get a ref to it in Stencil and I can pass that instead of the string id of it to the window.Smart() function and it will work. However, when I tried that it is saying e.indexof() is not a function and I presume it is because it is being treated as a string. Coming from a jquery background I’m sure you can recognize that sometimes it is beneficial to provide a css selector and sometimes it is easier and simpler and better to simply pass the element reference itself rather than a sizzle selector of it. I hope you will consider a feature request to pass an element instead of a string as first parameter of window.Smart().
other potential request to consider is to use smart-ui-grid without shadow mode. it can do some of the plumbing work to get the element initialized but it needs to not wrap content with shadow-dom so we can control the style. i think theming is not correctly implemented for most of shadow-dom grid anyway. it uses subcomponents like smart-grid-column which are not targeted by theme system, who uses class of .smart-grid-column (not tag of it) so the theme cannot override the background and foreground color of the grid column header with shadow on. this is a separate bug and another reason to not use shadow of smart-ui-grid.
-
AuthorPosts