forked from cocoo/easyui-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.html
193 lines (180 loc) · 8.32 KB
/
dialog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>dialog</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/SyntaxHighlighter.css" />
<script type="text/javascript" src="js/shCore.js"></script>
<script type="text/javascript" src="js/shBrushJScript.js"></script>
<script type="text/javascript" src="js/shBrushXml.js"></script>
</head>
<body style="text-align:left">
<div style="padding:10px">
<h3>Dialog</h3>
<p>Extend from $.fn.window.defaults. Override defaults with $.fn.dialog.defaults.</p>
<p>
The dialog is a special type of window, which can has a toolbar on top and a button bar on bottom.
The dialog has only one close tool display on top right of header by default.
Users can configure dialog behaviors to display other tools such as collapsible, minimizable, maximizable tool, etc.
</p>
<img src="images/dialog.png">
<h4>Dependencies</h4>
<ul>
<li>window</li>
<li>linkbutton</li>
</ul>
<h4>Usage</h4>
<p>
Create dialog via markup from an existing DOM node.
The example below shows a modal dialog with resizable feature.
</p>
<div class="dp-highlighter"><div class="bar"><div class="tools"></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><</span><span class="tag-name">div</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"dd"</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"easyui-dialog"</span><span> </span><span class="attribute">title</span><span>=</span><span class="attribute-value">"My Dialog"</span><span> </span><span class="attribute">style</span><span>=</span><span class="attribute-value">"width:400px;height:200px;"</span><span> </span></span></li><li class=""><span> <span class="attribute">data-options</span><span>=</span><span class="attribute-value">"iconCls:'icon-save',resizable:true,modal:true"</span><span class="tag">></span><span> </span></span></li><li class="alt"><span> Dialog Content. </span></li><li class=""><span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span> </span></span></li></ol></div><textarea class="html" name="code-dialog" style="display: none;"> <div id="dd" class="easyui-dialog" title="My Dialog" style="width:400px;height:200px;"
data-options="iconCls:'icon-save',resizable:true,modal:true">
Dialog Content.
</div>
</textarea>
<p>
Creating dialog using javascript is also allowed.
Now let's create a modal dialog and then call 'refresh' method to load its content via ajax.
</p>
<div class="dp-highlighter"><div class="bar"><div class="tools"></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><</span><span class="tag-name">div</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"dd"</span><span class="tag">></span><span>Dialog Content.</span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span> </span></span></li></ol></div><textarea class="html" name="code-dialog" style="display: none;"> <div id="dd">Dialog Content.</div>
</textarea>
<div class="dp-highlighter"><div class="bar"><div class="tools"></div></div><ol start="1" class="dp-c"><li class="alt"><span><span>$(</span><span class="string">'#dd'</span><span>).dialog({ </span></span></li><li class=""><span> title: <span class="string">'My Dialog'</span><span>, </span></span></li><li class="alt"><span> width: 400, </span></li><li class=""><span> height: 200, </span></li><li class="alt"><span> closed: <span class="keyword">false</span><span>, </span></span></li><li class=""><span> cache: <span class="keyword">false</span><span>, </span></span></li><li class="alt"><span> href: <span class="string">'get_content.php'</span><span>, </span></span></li><li class=""><span> modal: <span class="keyword">true</span><span> </span></span></li><li class="alt"><span>}); </span></li><li class=""><span>$(<span class="string">'#dd'</span><span>).dialog(</span><span class="string">'refresh'</span><span>, </span><span class="string">'new_content.php'</span><span>); </span></span></li></ol></div><textarea class="js" name="code-dialog" style="display: none;"> $('#dd').dialog({
title: 'My Dialog',
width: 400,
height: 200,
closed: false,
cache: false,
href: 'get_content.php',
modal: true
});
$('#dd').dialog('refresh', 'new_content.php');
</textarea>
<br>
<h4>Properties</h4>
<p>The properties extend from window, below is the overridden properties for dialog.</p>
<table class="doc-table">
<tbody><tr>
<th><strong>Name</strong></th>
<th><strong>Type</strong></th>
<th><strong>Description</strong></th>
<th><strong>Default</strong></th>
</tr>
<tr>
<td>title</td>
<td>string</td>
<td>The dialog title text.</td>
<td>New Dialog</td>
</tr>
<tr>
<td>collapsible</td>
<td>boolean</td>
<td>Defines if to show collapsible button.</td>
<td>false</td>
</tr>
<tr>
<td>minimizable</td>
<td>boolean</td>
<td>Defines if to show minimizable button.</td>
<td>false</td>
</tr>
<tr>
<td>maximizable</td>
<td>boolean</td>
<td>Defines if to show maximizable button.</td>
<td>false</td>
</tr>
<tr>
<td>resizable</td>
<td>boolean</td>
<td>Defined if the dialog can be resized.</td>
<td>false</td>
</tr>
<tr>
<td>toolbar</td>
<td>array,selector</td>
<td>
The top toolbar of dialog, possible values:<br>
1) an array, each tool options are same as linkbutton.<br>
2) a selector that indicating the toolbar.
<p>The dialog toolbar can be declared within a <div> tag:</p>
<pre><div class="easyui-dialog" style="width:600px;height:300px"
data-options="title:'My Dialog',toolbar:'#tb',modal:true">
Dialog Content.
</div>
<div id="tb">
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true"/a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-help',plain:true"/a>
</div>
</pre>
<p>The dialog toolbar can also be defined via array:</p>
<pre><div class="easyui-dialog" style="width:600px;height:300px"
data-options="title:'My Dialog',modal:true,
toolbar:[{
text:'Edit',
iconCls:'icon-edit',
handler:function(){alert('edit')}
},{
text:'Help',
iconCls:'icon-help',
handler:function(){alert('help')}
}]">
Dialog Content.
</div>
</pre>
</td>
<td>null</td>
</tr>
<tr>
<td>buttons</td>
<td>array,selector</td>
<td>
The bottom buttons of dialog, possible values:<br>
1) an array, each button options is same as linkbutton.<br>
2) a selector that indicating the button bar.
<p>The buttons can be declared within a <div> tag:</p>
<pre><div class="easyui-dialog" style="width:600px;height:300px"
data-options="title:'My Dialog',buttons:'#bb',modal:true">
Dialog Content.
</div>
<div id="bb">
<a href="#" class="easyui-linkbutton">Save</a>
<a href="#" class="easyui-linkbutton">Close</a>
</div>
</pre>
<p>The buttons can also be defined via array:</p>
<pre><div class="easyui-dialog" style="width:600px;height:300px"
data-options="title:'My Dialog',modal:true,
buttons:[{
text:'Save',
handler:function(){...}
},{
text:'Close',
handler:function(){...}
}]">
Dialog Content.
</div>
</pre>
</td>
<td>null</td>
</tr>
</tbody></table>
<h4>Events</h4>
<p>The events extend from window.</p>
<h4>Methods</h4>
<p>The methods extend from window, below is the added methods for dialog.</p>
<table class="doc-table">
<tbody><tr>
<th><strong>Name</strong></th>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
</tr>
<tr>
<td>dialog</td>
<td>none</td>
<td>Return the outer dialog object.</td>
</tr>
</tbody></table>
</div>
</body>
</html>