forked from cocoo/easyui-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogressbar.html
143 lines (134 loc) · 6.13 KB
/
progressbar.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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>progressbar</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>ProgressBar</h3>
<p>Override defaults with $.fn.progressbar.defaults.</p>
<p>
The progressbar provides a feedback of showing progress of an long-running operation.
The progress can be updated to let the user know that some operation is currently executing.
</p>
<img src="images/progressbar.png">
<h4>Dependencies</h4>
<ul>
<li>none</li>
</ul>
<h4>Usage Example</h4>
<h5>Create ProgressBar</h5>
<p>
The ProgressBar component can be created from html markup or programatically.
Creation from markup is even easier. Add 'easyui-progressbar' class to <div/> markup.
</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">"p"</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"easyui-progressbar"</span><span> </span><span class="attribute">data-options</span><span>=</span><span class="attribute-value">"value:60"</span><span> </span><span class="attribute">style</span><span>=</span><span class="attribute-value">"width:400px;"</span><span class="tag">></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-progressbar" style="display: none;"> <div id="p" class="easyui-progressbar" data-options="value:60" style="width:400px;"></div>
</textarea>
<p>Create ProgressBar using javascript.</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">"p"</span><span> </span><span class="attribute">style</span><span>=</span><span class="attribute-value">"width:400px;"</span><span class="tag">></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-progressbar" style="display: none;"> <div id="p" style="width:400px;"></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">'#p'</span><span>).progressbar({ </span></span></li><li class=""><span> value: 60 </span></li><li class="alt"><span>}); </span></li></ol></div><textarea class="js" name="code-progressbar" style="display: none;"> $('#p').progressbar({
value: 60
});
</textarea>
<br>
<h5>Get or Set Value</h5>
<p>We get the current value and set a new value for this component.</p>
<div class="dp-highlighter"><div class="bar"><div class="tools"></div></div><ol start="1" class="dp-c"><li class="alt"><span><span class="keyword">var</span><span> value = $(</span><span class="string">'#p'</span><span>).progressbar(</span><span class="string">'getValue'</span><span>); </span></span></li><li class=""><span><span class="keyword">if</span><span> (value < 100){ </span></span></li><li class="alt"><span> value += Math.floor(Math.random() * 10); </span></li><li class=""><span> $(<span class="string">'#p'</span><span>).progressbar(</span><span class="string">'setValue'</span><span>, value); </span></span></li><li class="alt"><span>} </span></li></ol></div><textarea class="js" name="code-progressbar" style="display: none;"> var value = $('#p').progressbar('getValue');
if (value < 100){
value += Math.floor(Math.random() * 10);
$('#p').progressbar('setValue', value);
}
</textarea>
<br>
<h4>Properties</h4>
<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>width</td>
<td>string</td>
<td>Set the progressbar width.</td>
<td>auto</td>
</tr>
<tr>
<td>value</td>
<td>number</td>
<td>The percentage value.</td>
<td>0</td>
</tr>
<tr>
<td>text</td>
<td>string</td>
<td>The text template to be displayed on component.</td>
<td>{value}%</td>
</tr>
</tbody></table>
<h4>Events</h4>
<table class="doc-table">
<tbody><tr>
<th><strong>Name</strong></th>
<th><strong>Parameters</strong></th>
<th><strong>Description</strong></th>
</tr>
<tr>
<td>onChange</td>
<td>newValue,oldValue</td>
<td>
Fires when the value is changed.
<p>Code example:</p>
<pre>$('#p').progressbar({
onChange: function(value){
alert(value)
}
});
</pre>
</td>
</tr>
</tbody></table>
<h4>Methods</h4>
<table class="doc-table">
<tbody><tr>
<th><strong>Name</strong></th>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
</tr>
<tr>
<td>options</td>
<td>none</td>
<td>Return the options object.</td>
</tr>
<tr>
<td>resize</td>
<td>width</td>
<td>
Resize the component.
<p>Code example:</p>
<pre>$('#p').progressbar('resize'); // resize the bar with original width
$('#p').progressbar('resize', 350); // resize the bar using a new width
</pre>
</td>
</tr>
<tr>
<td>getValue</td>
<td>none</td>
<td>Return the current progress value.</td>
</tr>
<tr>
<td>setValue</td>
<td>value</td>
<td>Set a new progress value.</td>
</tr>
</tbody></table>
</div>
</body>
</html>