These are chat archives for chandu0101/scalajs-react-components

17th
Dec 2015
Roberto Leibman
@rleibman
Dec 17 2015 17:39
I was really liking the datagrid, I particularly like how it looks, but there's a few places where I'm both stuck and pissed off at the way it's doing things. I'm trying to duplicate in scala their demo app, take a look at this:
In particular, the piece of code that goes:
onColumnResize: function(firstCol, firstSize, secondCol, secondSize){
firstCol.width = firstSize
this.setState({})
}
problem 1: trying to figure out what the heck types the function takes (how do people like javascript is beyond me)
problem 2: notice that firstCol.width means that firstCol is mutable!!! ugh!
problem 3: (and it goes with problem 2) instead of something like this.setState(columnstatemodified) it sets a mutable value and then does Nothing with the state (but I guess, does setState to force a re-render)
I tried to do this in java, by having a Column object and a MutableColumn trait (extending js.object), but it doesn't render when it's supposed to.
Roberto Leibman
@rleibman
Dec 17 2015 17:44
If this code smell wasn't enough, the datagrid component doesn't work well with the rest of the scalajs-react-components demo. The rows paint weirdly, and I end up getting all kinds of weird effects: overlapping elements, etc.
blob
Roberto Leibman
@rleibman
Dec 17 2015 18:03
BTW, the reason I wanted a more sophisticated grid is because I need to render a column with some actions. ReactTable doesn't seem to have that, MuiTable could probably do it with a hover and a menu on the hover.
Roberto Leibman
@rleibman
Dec 17 2015 22:16
OK... I think I'm taking on a different tack... I'm making some modifications to ReactTable to support the kind of column I need, in the process I also made some changes to it that make it (IMHO) a little more scala-like.
I'll need to back out the changes I made to put it the datagrid so I can file those as different PRs
Øyvind Raddum Berg
@oyvindberg
Dec 17 2015 23:26
haha, welcome to the pain of writing js wrappers there, @rleibman
we can probably make it work if you want to, though im even more happy if we can make ReactTable be really nice to use
Roberto Leibman
@rleibman
Dec 17 2015 23:27
I think I agree, if you have time, take a look at the changes I made to it, I've done a PR on it.
Øyvind Raddum Berg
@oyvindberg
Dec 17 2015 23:28
yeah i just left a few comments there
Roberto Leibman
@rleibman
Dec 17 2015 23:29
I saw them.... I'll answer.
Roberto Leibman
@rleibman
Dec 17 2015 23:36
On a different tack... I need a context menu. Now that I'm warming up with all the technologies, I could probably create one from scratch, or I could wrap https://github.com/vkbansal/react-contextmenu
Material doesn't have a context menu, right?
Øyvind Raddum Berg
@oyvindberg
Dec 17 2015 23:40
perhaps you could make the menus work somehow, but now, it's pretty much geared at touch users
i mean open a menu when you right click a button for example sounds easy enough already
Roberto Leibman
@rleibman
Dec 17 2015 23:42
ok, I'll take a look, it doesn't seem to be terribly complicated code, so I might take some ideas to duplicate it in scala.js.