docjones Posted May 25, 2021 Share Posted May 25, 2021 Hi All. I'm doing and application that load a custom leaflet map in a urlframe (maps it's loading and working fine), this map create a custom points/poligons and i need to detect when the user click this points and show a unigui custom dialog. The problem it's that how to know the jsname of urlframe (inside javascript) to fire the ajaxrequest and catch the event in unigui application. i can see that urlfame1.jsname it's O2A, and if i put this name in ajaxrequest i can catch the event in the urlframe onajaxrequest event, but how to get this jsname in jscript ? thats the jscript map. var geoMap = null; var pin = null; function onClicked(sender, args) { var go = sender; //alert(go.id); ajaxRequest(uniframe, 'customEvent', { name: sender.text, id: sender.id } ); } function createTestMap() { console.log('createMap'); var divName = "uni_map_leaflet"; var zoomConf = new GeoMapZoomConfig(20, 10, 22); var config = new GeoMapConfig(GeoMapType.Default, "Mapa de test", 39.466667, -0.375000, zoomConf); geoMap = new GeoMap(divName, config); pin = new GeoAwesomeMarker(geoMap, "PIN", [new GeoPoint(39.476267, -0.375000)], "Pinde prueba", "", true, "frog", "red"); pin.clickEvent.attach(onClicked); pin.createElement(true); } setTimeout(function () { return createTestMap(); }, 1000); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 25, 2021 Share Posted May 25, 2021 1 hour ago, docjones said: i can see that urlfame1.jsname it's O2A, and if i put this name in ajaxrequest i can catch the event in the urlframe onajaxrequest event, but how to get this jsname in jscript ? Hello, One possible solution. See this demo: \FMSoft\Framework\uniGUI\Demos\Desktop\ClientEvents-HtmlToAjax function beforeInit(sender, config) { config.id = '_HTMLFrame'; } HTML: <script> function callServer(elmnt, event) { var HTMLFrame = Ext.getCmp("_HTMLFrame"); var params=[]; switch (elmnt.type) { case "text": case "password": params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ]; break; case "button": params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ]; break; case "checkbox": params = ["id="+elmnt.id, "val="+elmnt.value, "checked="+elmnt.checked, "xevent="+event ]; break; }; if (params.length>0) { ajaxRequest(HTMLFrame, 'callserver', params); } } </script> <input type="text" id="txt1" name="txt1" onblur="callServer(this,'onblur')"><br> <input type="password" id="psw1" name="psw1" onblur="callServer(this,'onblur')"><br> <br> <input type="checkbox" id="chBox1" name="chBox1" value="1" onclick="callServer(this,'onclick')"> <label for="chBox1">CheckBox1</label><br> <br> <input type="button" id="btn1" name="btn1" value="ClickMe" onclick="callServer(this,'onclick')"><br> <br> <br> 1 Quote Link to comment Share on other sites More sharing options...
docjones Posted May 26, 2021 Author Share Posted May 26, 2021 thanks, i see the way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.