Getting HotInstance from DOM Element

Tags: #<Tag:0x00007f8b25afb290> #<Tag:0x00007f8b25afa598>

I have two separate components Header and body in separate files.
I want to access HandsOntable instance which is in Body to Header compoenent. Querying DOM is returning HTML Element, how to cast it as HotInstance? I have to alter hiddenColumns suing hidden column plugin?

Hi @jamshaidbutt055

It would be hard to propose anything without knowing basic configuration details like your data structure, framework/vanilla JS. Can you prepare a demo that shows the structure?

I am working in ReactTs, My scenario is I have to hide columns either from context menu or from another component.
I am saving hidden columns array in session storage whenever a user hides column from context menu using AfterHidecolumns hook.
I am setting a global state from another column and passing hiddenColumn that state. this is where issue comes. When state changes, afterHideColumns fired, which does gives me DestinationHideConfig having old columns. my logic fails … I think it is related to internal state management of handsontable. and handsontable does not change internal state… I need to programatically hide column everytime.

Do you get the same output like here https://codesandbox.io/s/optimistic-darkness-r2iyxt?file=/src/Hot.js:0-874 (with the node error) or something else? I think that this may may caused by the CodeSanbox itself but I do not see any sandbox alternatives for a catalog tree component structure.

I have made it to work with useEffect(). And manually hiding columns when state change, this works… I want this to run when component mounts. at that time, it runs the code but UI doesn’t hide columns… I have already tried putting hotinstance.render() inside setTimeout but it does not work… but when i change state it works…

Could you please share a demo with your latest progress? I recommend forking my CodeSandbox demo. Only then we will make sure we are on the same page.

Hi. Do we have any updates regarding this issue, @jamshaidbutt055?

You can close the topic or even delete it as this topic has nothing really informative.

Thank you for the feedback. I will close the topic then.