Last active
February 8, 2019 15:08
-
-
Save chomookun/3c51b4c7ce67d02acf4fac50fcdf5161 to your computer and use it in GitHub Desktop.
duice.ui.Dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button onclick="javascript:openUserDialog();"> | |
openUserDialog(); | |
</button> | |
<button onclick="javascript:openUserDialogWithListener();"> | |
openUserDialogWithListener(); | |
</button> | |
<dialog> | |
<div id="userDialog"> | |
<table class="userTable"> | |
<tbody> | |
<tr> | |
<th>id</th> | |
<td><label data-duice="Label" data-duice-bind="user.id"></label></td> | |
</tr> | |
<tr> | |
<th>name</th> | |
<td><input data-duice="TextField" data-duice-bind="user.name"/></td> | |
</tr> | |
<tr> | |
<th>message</th> | |
<td><textarea data-duice="TextArea" data-duice-bind="user.message"></textarea></td> | |
</tr> | |
</tbody> | |
</table> | |
<div style="text-align:right;"> | |
<button onclick="javascript:alert(JSON.stringify(user.toJson()));"> | |
alert(JSON.stringify(user.toJson())); | |
</button> | |
</div> | |
</div> | |
</dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defines user map data object | |
var user = new duice.data.Map({ | |
id:"apple", | |
name:"Apple", | |
message: "Hi~ My name is Apple." | |
}); | |
// open dialog | |
function openUserDialog() { | |
new duice.ui.Dialog('Dialog Title', document.getElementById('userDialog')) | |
.open(); | |
} | |
// open dialog with listener | |
function openUserDialogWithListener() { | |
new duice.ui.Dialog('Dialog Title', document.getElementById('userDialog')) | |
.beforeOpen(function() { | |
return confirm('open dialog?'); | |
}) | |
.afterOpen(function() { | |
alert('after open'); | |
}) | |
.beforeClose(function() { | |
return confirm('close dialog?'); | |
}) | |
.afterClose(function() { | |
alert('after close'); | |
}) | |
.open(); | |
} | |
///////////////////////////////////////// | |
//////////////////////////////////////// | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://duice.oopscraft.net/src/duice.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
margin:0px; | |
padding:0px; | |
font-size:1em; | |
line-height:2; | |
} | |
table.userTable { | |
width: 400px; | |
border: solid 1px #ccc; | |
border-collapse: collapse; | |
} | |
table.userTable th { | |
border: dotted 1px #eee; | |
background-color:#eee; | |
} | |
table.userTable td { | |
border: dotted 1px #eee; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="http://duice.oopscraft.net/src/duice.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment