Discussion:
[mapguide-users] MapGuide React
Jamo
2018-10-16 03:39:05 UTC
Permalink
Hey MapGuider's

I'm trying to get my head around the new react sidebar viewer and adapt it
to some specific needs ....

For the life of me I can't seem to get my head around the whole redux /
store / action .... I'm trying to add a sort of plan viewer as another
sidebar button / pane, it works well by itself but I'm now trying to
integrate it a little more by adding it to the application store so when a
feature with a certain attribute (basically a href ...) is clicked or a row
in a table is clicked it updates the application state and then the relevant
reducer or however it works ... updates the preview pane.

So basically I have a form with some search criteria that return some rows
....
I have a preview pane that holds an iframe to preview the document ....
I have a new application state / store that has a string value.
when the is updated I want the preview frame to change accordingly ....

If anyone can enlighten me with some examples of how to add a new reducer /
store and dispatch to it with regards to the new sidebar viewer it would be
great .... I feel I'm close to figuring it out ... I'll see if I can put an
example of what I'm trying to do up.

Also I'm basically forking the react viewer and making my changes, but
perhaps theres a better way to keep my changes more generic and separate so
I can better roll with any updates to the viewer

Another wall of text ...... sorry

Adam




-----
MapGuide Maestro 6.0.0.8587
MapGuide Opensource 3.0.0.8701
Fusion, PHP, Apache
Windows 7 Pro SP1

--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jamo
2018-10-17 03:09:34 UTC
Permalink
OK I wasn't using the default export of the container in my layout ....
therefore the connect / MapDispatchToprops and what not wasn't getting
fired....

Looks like it works as expected knew it was gonna be something simple ....

Sorry to be a pain and answer my own problem ... I'll see if I can get an
example of what I've been paying around with maybe try and make it a bit
more generic.

Cheers
Adam



-----
MapGuide Maestro 6.0.0.8587
MapGuide Opensource 3.0.0.8701
Fusion, PHP, Apache
Windows 7 Pro SP1

--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-10-17 12:11:55 UTC
Permalink
Hey, sometimes just spelling out the problem into the ether will make the
solution reveal itself in due course. This tried and true method even has
its own name:

https://en.wikipedia.org/wiki/Rubber_duck_debugging

Anyways, regarding custom reducers, have you checked out this sample repo?

https://github.com/jumpinjackie/mapguide-react-layout-example

If you want to do this in a non-disruptive manner (ie. Not having to modify
and maintain your own fork of mapguide-react-layout) then the way to do it
is to create your own custom viewer bundle via the npm module and sub-class
the ApplicationViewModel and exporting that out to the MapGuide namespace as
MapGuide.Application instead of exporting the default ApplicationViewModel.

In your sub-classed ApplicationViewModel you can override getExtraReducers()
to add extra custom branches of application state as demonstrated here:

https://github.com/jumpinjackie/mapguide-react-layout-example/blob/master/src/app.tsx

- Jackie




--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Loading...