提交 | 用户 | 时间
|
58d006
|
1 |
/** |
A |
2 |
The widget box reload button/event handler. You should use your own handler. An example is available at <i class="text-info">examples/widgets.html</i>. |
|
3 |
<u><i class="glyphicon glyphicon-flash"></i> You don't need this. Used for demo only</u> |
|
4 |
*/ |
|
5 |
|
|
6 |
(function($ , undefined) { |
|
7 |
|
|
8 |
//***default action for reload in this demo |
|
9 |
//you should remove this and add your own handler for each specific .widget-box |
|
10 |
//when data is finished loading or processing is done you can call $box.trigger('reloaded.ace.widget') |
|
11 |
$(document).on('reload.ace.widget', '.widget-box', function (ev) { |
|
12 |
var $box = $(this); |
|
13 |
|
|
14 |
//trigger the reloaded event to remove the spinner icon after 1-2 seconds |
|
15 |
setTimeout(function() { |
|
16 |
$box.trigger('reloaded.ace.widget'); |
|
17 |
}, parseInt(Math.random() * 1000 + 1000)); |
|
18 |
}); |
|
19 |
|
|
20 |
//you may want to do something like this: |
|
21 |
/** |
|
22 |
$('#my-widget-box').on('reload.ace.widget', function(){ |
|
23 |
//load new data here |
|
24 |
//and when finished trigger "reloaded" event |
|
25 |
$(this).trigger('reloaded.ace.widget'); |
|
26 |
}); |
|
27 |
*/ |
|
28 |
})(window.jQuery); |