Author: sevein
Date: Tue Jun 26 18:30:36 2012
New Revision: 11819
Log:
Show the loading icon every time a node is expanded, collapsed, etc...
Modified:
trunk/css/graphic.css
trunk/js/treeView.js
Modified: trunk/css/graphic.css
==============================================================================
--- trunk/css/graphic.css Tue Jun 26 18:29:41 2012 (r11818)
+++ trunk/css/graphic.css Tue Jun 26 18:30:36 2012 (r11819)
@@ -367,8 +367,8 @@
#treeview li .loading
{
display: inline-block;
- width: 22px;
- height: 18px;
+ width: 16px;
+ height: 16px;
background-image: url(../images/loading.small.gif);
background-repeat: no-repeat;
background-position: 50% 50%;
Modified: trunk/js/treeView.js
==============================================================================
--- trunk/js/treeView.js Tue Jun 26 18:29:41 2012 (r11818)
+++ trunk/js/treeView.js Tue Jun 26 18:30:36 2012 (r11819)
@@ -208,11 +208,35 @@
this.highlightLastAncestor();
},
- setLoading: function (status)
+ setLoading: function (status, $node)
{
this.loading = status;
- this.$element.toggleClass('loading', status);
+ if (this.loading)
+ {
+ this.$element.addClass('loading');
+
+ if ($node)
+ {
+ // Add loading icon
+ $node.append('<div class="loading" />');
+ $node.children('i').css('visibility', 'hidden');
+ }
+ }
+ else
+ {
+ this.$element.removeClass('loading');
+
+ if ($node)
+ {
+ // Remove loading icon
+ $node
+ .children('.loading').remove().end()
+ .children('i').css('visibility', 'visible');
+ }
+ }
+
+ return this;
},
installSortableBehavior: function ()
@@ -302,11 +326,7 @@
data: data,
beforeSend: function ()
{
- this.setLoading(true);
-
- // Add loading icon
- ui.item.prepend('<div class="loading" />');
- ui.item.children('i').css('visibility', 'hidden');
+ this.setLoading(true, ui.item);
},
success: function ()
{
@@ -315,12 +335,7 @@
},
complete: function ()
{
- this.setLoading(false);
-
- // Remove loading icon
- ui.item
- .children('.loading').remove().end()
- .children('i').css('visibility', 'visible');
+ this.setLoading(false, ui.item);
},
error: function (jqXHR, textStatus, thrownError)
{
@@ -433,7 +448,7 @@
data: { show: 'all', resourceId: this.resourceId },
beforeSend: function ()
{
- this.setLoading(true);
+ this.setLoading(true, $element);
},
success: function (data)
{
@@ -448,7 +463,7 @@
},
complete: function ()
{
- this.setLoading(false);
+ this.setLoading(false, $element);
},
error: function ()
{
@@ -467,7 +482,7 @@
data: { show: 'item', resourceId: this.resourceId },
beforeSend: function ()
{
- this.setLoading(true);
+ this.setLoading(true, $element);
},
success: function (data)
{
@@ -495,7 +510,7 @@
},
complete: function ()
{
- this.setLoading(false);
+ this.setLoading(false, $element);
},
error: function ()
{
@@ -514,7 +529,7 @@
data: { show: 'item', resourceId: this.resourceId },
beforeSend: function ()
{
- this.setLoading(true);
+ this.setLoading(true, $element);
},
success: function (data)
{
@@ -532,7 +547,7 @@
},
complete: function ()
{
- this.setLoading(false);
+ this.setLoading(false, $element);
},
error: function ()
{
@@ -557,7 +572,7 @@
data: { show: !$element.next().length ? 'nextSiblings' :
'prevSiblings', resourceId: this.resourceId },
beforeSend: function()
{
- this.setLoading(true);
+ this.setLoading(true, $element);
},
success: function (data)
{
@@ -569,7 +584,7 @@
},
complete: function ()
{
- this.setLoading(false);
+ this.setLoading(false, $element);
window.clearTimeout(loadingId);
},
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.