fit-ui 2.12.2 → 2.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Fit.UI.js CHANGED
@@ -682,7 +682,7 @@ Fit._internal =
682
682
  {
683
683
  Core:
684
684
  {
685
- VersionInfo: { Major: 2, Minor: 12, Patch: 2 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
685
+ VersionInfo: { Major: 2, Minor: 12, Patch: 3 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
686
686
  }
687
687
  };
688
688
 
@@ -21072,7 +21072,7 @@ Fit.Controls.WSDropDown = function(ctlId)
21072
21072
  return list.JsonpCallback();
21073
21073
  }
21074
21074
 
21075
- /// <function container="Fit.Controls.WSDropDownTypeDefs" name="ClearDataCallback">
21075
+ /// <function container="Fit.Controls.WSDropDownTypeDefs" name="DataCallback">
21076
21076
  /// <description> Event handler </description>
21077
21077
  /// <param name="sender" type="$TypeOfThis"> Instance of control </param>
21078
21078
  /// </function>
@@ -21084,54 +21084,43 @@ Fit.Controls.WSDropDown = function(ctlId)
21084
21084
  /// Operation may be postponed if data is currently loading from WebService.
21085
21085
  /// Use callback to pick up execution once data has been cleared.
21086
21086
  /// Sender (Fit.Controls.WSDropDown) is passed to callback as an argument.
21087
+ /// To make sure data reloads immediate, please use ReloadData(..) instead.
21087
21088
  /// </description>
21088
- /// <param name="cb" type="Fit.Controls.WSDropDownTypeDefs.ClearDataCallback" default="undefined">
21089
+ /// <param name="cb" type="Fit.Controls.WSDropDownTypeDefs.DataCallback" default="undefined">
21089
21090
  /// If defined, callback is invoked when data is cleared
21090
21091
  /// </param>
21091
21092
  /// </function>
21092
21093
  this.ClearData = function(cb)
21093
21094
  {
21094
- Fit.Validation.ExpectFunction(cb, true);
21095
-
21096
- // Postpone if WebService operation is currently running
21097
-
21098
- if (requestCount > 0)
21099
- {
21100
- // Data is currently loading - postpone by adding request to process queue
21101
- onDataLoaded(function() { me.ClearData(cb); });
21102
- return;
21103
- }
21104
-
21105
- // Clear data/cache/state
21106
-
21107
- hideLinesForFlatData = true; // Make TreeView hide helper lines if nodes received have no children
21108
- dataRequested = false; // Make data in TreeView reload via ensureTreeViewData() when DropDown is opened
21109
- autoUpdatedSelections = null; // Remove cached result from AutoUpdateSelected(..) used when multiple calls to the function is made
21110
-
21111
- // Update action menu
21112
-
21113
- // Update action menu in case "Show available options" has been disabled, which
21114
- // will be the case if the previous request returned no data. We need it enabled if
21115
- // action menu is enabled - otherwise the user won't be able to request updated data.
21116
- updateActionMenu();
21117
-
21118
- // Cancel pending search operation if scheduled
21119
-
21120
- cancelSearch();
21095
+ clearData(true, cb);
21096
+ }
21121
21097
 
21122
- // Invoke callback
21098
+ /// <function container="Fit.Controls.WSDropDown" name="ReloadData" access="public">
21099
+ /// <description>
21100
+ /// Call this function to make control reload data immediately,
21101
+ /// ensuring that the user will see the most recent values available.
21102
+ /// Use callback to pick up execution once data has been loaded.
21103
+ /// Sender (Fit.Controls.WSDropDown) is passed to callback as an argument.
21104
+ /// To have data reload when needed (lazy loading), please use ClearData(..) instead.
21105
+ /// </description>
21106
+ /// <param name="cb" type="Fit.Controls.WSDropDownTypeDefs.DataCallback" default="undefined">
21107
+ /// If defined, callback is invoked when data has been loaded
21108
+ /// </param>
21109
+ /// </function>
21110
+ this.ReloadData = function(cb)
21111
+ {
21112
+ // Clear data - this will update action menu to make sure "Show avilable options" is shown
21123
21113
 
21124
- if (Fit.Validation.IsSet(cb) === true)
21114
+ clearData(false, function() // false = prevent clearData(..) from reloading data
21125
21115
  {
21126
- cb(me);
21127
- }
21116
+ // Reload data. The action menu will once again be updated if no data is received
21117
+ // to make sure "Show available options" is replaced by "List with options is empty".
21128
21118
 
21129
- // Immediately load TreeView data if DropDown is open and TreeView is active picker
21130
-
21131
- if (me.IsDropDownOpen() === true && me.GetPicker() === tree)
21132
- {
21133
- ensureTreeViewData(); // Will not load anything if callback above triggered data load, e.g. by calling AutoUpdateSelected(..)
21134
- }
21119
+ ensureTreeViewData(function()
21120
+ {
21121
+ cb && cb(me);
21122
+ });
21123
+ });
21135
21124
  }
21136
21125
 
21137
21126
  this.MultiSelectionMode = Fit.Core.CreateOverride(this.MultiSelectionMode, function(val)
@@ -21490,9 +21479,9 @@ Fit.Controls.WSDropDown = function(ctlId)
21490
21479
  // Private
21491
21480
  // ============================================
21492
21481
 
21493
- function ensureTreeViewData(/*cb*/)
21482
+ function ensureTreeViewData(cb)
21494
21483
  {
21495
- //Fit.Validation.ExpectFunction(cb, true);
21484
+ Fit.Validation.ExpectFunction(cb, true);
21496
21485
 
21497
21486
  if (dataRequested === false)
21498
21487
  {
@@ -21508,16 +21497,62 @@ Fit.Controls.WSDropDown = function(ctlId)
21508
21497
  // calls updateActionMenu(..) which relies on this flag.
21509
21498
  showActionMenuIfNoDataReceivedOrOnFirstInteractionIfEnabled();
21510
21499
 
21511
- /*if (Fit.Validation.IsSet(cb) === true)
21500
+ if (Fit.Validation.IsSet(cb) === true)
21512
21501
  {
21513
21502
  cb(me);
21514
- }*/
21503
+ }
21515
21504
 
21516
21505
  fireOnDataLoaded();
21517
21506
  });
21518
21507
  }
21519
21508
  }
21520
21509
 
21510
+ function clearData(allowImmediateReload, cb)
21511
+ {
21512
+ Fit.Validation.ExpectBoolean(allowImmediateReload);
21513
+ Fit.Validation.ExpectFunction(cb, true);
21514
+
21515
+ // Postpone if WebService operation is currently running
21516
+
21517
+ if (requestCount > 0)
21518
+ {
21519
+ // Data is currently loading - postpone by adding request to process queue
21520
+ onDataLoaded(function() { me.ClearData(cb); });
21521
+ return;
21522
+ }
21523
+
21524
+ // Clear data/cache/state
21525
+
21526
+ hideLinesForFlatData = true; // Make TreeView hide helper lines if nodes received have no children
21527
+ dataRequested = false; // Make data in TreeView reload via ensureTreeViewData() when DropDown is opened
21528
+ autoUpdatedSelections = null; // Remove cached result from AutoUpdateSelected(..) used when multiple calls to the function is made
21529
+
21530
+ // Update action menu
21531
+
21532
+ // Update action menu in case "Show available options" has been disabled, which
21533
+ // will be the case if the previous request returned no data. We need it enabled if
21534
+ // action menu is enabled - otherwise the user won't be able to request updated data.
21535
+ updateActionMenu();
21536
+
21537
+ // Cancel pending search operation if scheduled
21538
+
21539
+ cancelSearch();
21540
+
21541
+ // Invoke callback
21542
+
21543
+ if (Fit.Validation.IsSet(cb) === true)
21544
+ {
21545
+ cb(me);
21546
+ }
21547
+
21548
+ // Immediately load TreeView data if DropDown is open and TreeView is active picker
21549
+
21550
+ if (allowImmediateReload === true && me.IsDropDownOpen() === true && me.GetPicker() === tree)
21551
+ {
21552
+ ensureTreeViewData(); // Will not load anything if callback above triggered data load, e.g. by calling AutoUpdateSelected(..)
21553
+ }
21554
+ }
21555
+
21521
21556
  function showActionMenuIfNoDataReceivedOrOnFirstInteractionIfEnabled()
21522
21557
  {
21523
21558
  // If no data is returned and DropDown is in TextSelectionMode, the user will