Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>SetExternalFrame allows you to communicate with external iframe content by calling a function within the iframe and passing data from the current Drapo application context</p>
26 changes: 26 additions & 0 deletions src/WebDocs/wwwroot/app/functions/SetExternalFrame/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"Name": "FrameID",
"Description": "The ID of the iframe element to communicate with",
"Types": [ "text", "mustache" ],
"Optional": false
},
{
"Name": "ExternalFunction",
"Description": "The name of the function to call within the iframe",
"Types": [ "text", "mustache" ],
"Optional": false
},
{
"Name": "DataKey",
"Description": "The data key containing the data to pass to the iframe function",
"Types": [ "text", "mustache" ],
"Optional": false
},
{
"Name": "IsClone",
"Description": "Whether to clone the data before passing it to the iframe (default: false)",
"Types": [ "boolean", "mustache" ],
"Optional": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script src="/drapo.js"></script>
<title>Function - SetExternalFrame</title>
</head>
<body>
<span>Function - SetExternalFrame</span>
<div>
<div d-dataKey="userData" d-dataType="object" d-dataProperty-name="John" d-dataProperty-email="john@example.com" d-dataProperty-age="30"></div>
<h3>User Data:</h3>
<p>Name: <span d-model="{{userData.name}}"></span></p>
<p>Email: <span d-model="{{userData.email}}"></span></p>
<p>Age: <span d-model="{{userData.age}}"></span></p>
<br />
<input type="button" value="Send Data to Frame" d-on-click="SetExternalFrame(targetFrame,receiveUserData,userData,false)" />
<br />
<br />
<iframe id="targetFrame" src="about:blank" style="width: 100%; height: 200px; border: 1px solid #ccc;"></iframe>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>Basic iframe communication example that sends user data to an external iframe</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script src="/drapo.js"></script>
<title>Function - SetExternalFrame with Cloning</title>
</head>
<body>
<span>Function - SetExternalFrame with Cloning</span>
<div>
<div d-dataKey="productList" d-dataType="array" d-dataValue="[{&quot;id&quot;: 1, &quot;name&quot;: &quot;Laptop&quot;, &quot;price&quot;: 999},{&quot;id&quot;: 2, &quot;name&quot;: &quot;Mouse&quot;, &quot;price&quot;: 25},{&quot;id&quot;: 3, &quot;name&quot;: &quot;Keyboard&quot;, &quot;price&quot;: 75}]"></div>
<h3>Product List:</h3>
<div d-for="product in productList">
<p>{{product.id}} - {{product.name}}: ${{product.price}}</p>
</div>
<br />
<input type="button" value="Send Products to Frame (Cloned)" d-on-click="SetExternalFrame(productFrame,displayProducts,productList,true)" />
<input type="button" value="Send Products to Frame (Reference)" d-on-click="SetExternalFrame(productFrame,displayProducts,productList,false)" />
<br />
<br />
<iframe id="productFrame" src="about:blank" style="width: 100%; height: 300px; border: 1px solid #ccc;"></iframe>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>Advanced example showing data cloning and bidirectional communication with an iframe</p>