[mapguide-users] Adding custom command in react layout

TabrizSoftware Ali_Akhavan2 at yahoo.com
Thu Jan 26 06:31:04 PST 2017


Hi Jackie, 
I have a question about execute *setScale *command from 
a function in /application.tsx/

i want to add function in /application.tsx/ to communicate 
custom ui (in template) with Mapguide react
 
  	  
application.tsx
    
  	  
import * as React from "react";
  
import * as ReactDOM from "react-dom";
  
import { Provider } from  "react-redux";
  
import { IAppProps, App } from  "../containers/app";
  
import { ClientKind } from "../api/common";
  
import { ClientContext } from  "../api/client";
  
import configureStore from  "../store/configure-store";
  
import { INITIAL_STATE } from  "../reducers/config";
  
 
  
import * as MapActions from  "../actions/map";
  
/**
  
 *  This is the entry point to the Application component
  
 */
  
export class ApplicationViewModel {
  
    constructor() {
  
        
  
     }
  
     public mount(node: Element, props:  IAppProps) {
  
        const agentConf = {
  
            agentUri: props.agent.uri,
  
            agentKind: props.agent.kind ||  "mapagent"
  
        };
  
         const store = configureStore({ config: { ...INITIAL_STATE, 
...agentConf } });
  
        ReactDOM.render(<Provider  store={store}>
  
            <App {...props} />
  
        </Provider>, node);
  
    }
  
                
  
                public  setScale_To_20000()
  
                {
  
                                // I don’t khnow  how to call _setScale_
function
  
                                return 'Ok';
  
                }
  
}
   
 
 
 
  	  
Index.html
    
  	  
var el =  document.getElementById("map");
  
            var viewer  = new MapGuide.Application();
  
            viewer.mount(el, {
  
                layout:  "ajax-viewer",
  
                externalBaseLayers: [
  
                    { name:  "OpenStreetMap", kind:
"OSM" },
  
                ],
  
                agent: {
  
                    uri:  "../mapagent/mapagent.fcgi"
  
                }
  
            });
  
 
  
 
  
*viewer**. setScale_To_20000();*
  
* *
  
* *
   




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Adding-custom-command-in-react-layout-tp5304940.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20170126/45052ab6/attachment.html>


More information about the mapguide-users mailing list