【发布时间】:2021-01-18 07:42:15
【问题描述】:
我正在 Acumatica 中进行概念验证项目。
概念
我想开发一个检索客户列表的页面 地址并将它们绘制在嵌入的 Google 地图元素上。
问题
我知道如何检索客户地址列表,并且我有一篇文章中的代码解释了如何绘制地图点。我的问题是,地图本身是一个动态 JavaScript 函数,而不是来自其他地方的嵌入式地图。我正在努力寻找一种方法来使用以下代码(或类似代码)在自定义页面上显示结果。
我尝试过的概念:
- (当前)使用
PXLiteral封装所需元素 - 手动编辑 ASPX 以包含自定义编辑器通常会删除的
<div>和<script>元素 - 创建自定义 MasterPage 文件以删除页面限制
所有这些尝试在代码编译和页面加载的意义上都奏效了。但是,它们都没有在页面上显示任何元素的意义上起作用。
代码
<%@ Page Language="C#" MasterPageFile="~/MasterPages/MapView.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="IN30MX00.aspx.cs" Inherits="Page_IN30MX00" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/MapView.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="MixingCustomization.Map"
PrimaryView="MasterView">
<CallbackCommands>
</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXLiteral runat="server" Text="l1">
<div id="map" runat="server"></div>
</px:PXLiteral>
<px:PXLiteral runat="server" Text="l2">
<script>
// Initialize and add the map
function initMap() {
// The location of Uluru
var uluru = { lat: -25.344, lng: 131.036 };
// The map, centered at Uluru
var map = new google.maps.Map(
document.getElementById('map'), { zoom: 4, center: uluru });
// The marker, positioned at Uluru
var marker = new google.maps.Marker({ position: uluru, map: map });
}
</script>
</px:PXLiteral>
<px:PXLiteral runat="server" Text="l3">
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
</px:PXLiteral>
</asp:Content>
问题
- 是否有人有任何有用的指导或 2) 确定这是不可能的。
【问题讨论】:
标签: asp.net google-maps acumatica