-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods on component accessible to JS #837
Comments
Hey! Yes, the way to do that is to create a standard Scala.JS facade that includes Here's an example in the unit tests that should help: |
Great! Thanks for the quick response. I figured there had to be a way. :) Thanks for the awesome library. Once I get it working in my code, I'll create an example for the docs and submit a PR. |
No worries at all.
Woah thank you very much. I like to throw those statements out there just in case but I never really expect a response. It's very much appreciated so thanks a lot! |
I created PR #838 for the I see how In this case we need to pass a Scala component to a JS component (ag-grid-react in this case), that expects to be able to call certain methods on our component. We do have components where we have methods defined in the backend of a Scala component that we call from elsewhere, but that requires something like |
Hi there! I've been trying to solve this issue too. Just for reference: we need to create a component like this one, which has a Passing Since we need to pass a JS class component, I tried passing And that's as far as I got for now, I haven't figured out what |
Just a word of warning. I use JS components from within Scala often but I've never really called Scala components from JS. I've made all the raw JS representations accessible via @toddburnside Yeah, all the custom Scala methods go in the backend so to access from JS you'd have to access the backend first. If you want to execute a @rpiaggio Sorry man I don't quite understand what you mean. That JS component is calling |
Thanks for the response @japgolly . At the moment we are looking into an option that does not require the above. If that doesn't work out, I may try the JS wrapper for the Scala component. |
I believe I've come up with a solution to this.
|
Hi,
We have created a facade for
ag-grid-react
using ScalablyTyped. The basic functionality is working fine, but the grid allows for things like custom cell renderers and cell editors to be specified as react components. I am able to pass in components using either a function as described in INTEROP.md, and withcomponent.cmapCtorProps[…](…).toJsComponent.raw
.However, the grid requires some extra “lifecycle” functions to be available on some of the components, such as
getValue(): js.Any
, which the grid uses to get the new value after editing is completed. I was hoping that if I put the functions in the Backend of the component, they would be visible to the grid. But, no matter what I try, I get this helpful message in the console: “ag-Grid: Framework component is missing the method getValue()".Is there a way to make extra functions in a component visible to the grid?
A jsx example of what I'm talking about is: https://github.com/ag-grid/ag-grid-react-example/blob/master/src-examples/richGridDeclarativeExample/NameCellEditor.jsx In the jsx, they just define the lifecycle methods right alongside the render method.
Thanks!
The text was updated successfully, but these errors were encountered: