fit-ui 2.12.2 → 2.12.4

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: 4 } // 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,39 @@ 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();
21121
-
21122
- // Invoke callback
21123
-
21124
- if (Fit.Validation.IsSet(cb) === true)
21125
- {
21126
- cb(me);
21127
- }
21128
-
21129
- // Immediately load TreeView data if DropDown is open and TreeView is active picker
21095
+ clearData(true, true, cb);
21096
+ }
21130
21097
 
21131
- if (me.IsDropDownOpen() === true && me.GetPicker() === tree)
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
+ clearData(false, false, function() // false 1 = prevent clearData(..) from reloading data, false 2 = prevent action menu from updating to avoid flickering - done when data has been reloaded
21132
21113
  {
21133
- ensureTreeViewData(); // Will not load anything if callback above triggered data load, e.g. by calling AutoUpdateSelected(..)
21134
- }
21114
+ ensureTreeViewData(function()
21115
+ {
21116
+ updateActionMenu();
21117
+ cb && cb(me);
21118
+ });
21119
+ });
21135
21120
  }
21136
21121
 
21137
21122
  this.MultiSelectionMode = Fit.Core.CreateOverride(this.MultiSelectionMode, function(val)
@@ -21490,9 +21475,9 @@ Fit.Controls.WSDropDown = function(ctlId)
21490
21475
  // Private
21491
21476
  // ============================================
21492
21477
 
21493
- function ensureTreeViewData(/*cb*/)
21478
+ function ensureTreeViewData(cb)
21494
21479
  {
21495
- //Fit.Validation.ExpectFunction(cb, true);
21480
+ Fit.Validation.ExpectFunction(cb, true);
21496
21481
 
21497
21482
  if (dataRequested === false)
21498
21483
  {
@@ -21508,16 +21493,63 @@ Fit.Controls.WSDropDown = function(ctlId)
21508
21493
  // calls updateActionMenu(..) which relies on this flag.
21509
21494
  showActionMenuIfNoDataReceivedOrOnFirstInteractionIfEnabled();
21510
21495
 
21511
- /*if (Fit.Validation.IsSet(cb) === true)
21496
+ if (Fit.Validation.IsSet(cb) === true)
21512
21497
  {
21513
21498
  cb(me);
21514
- }*/
21499
+ }
21515
21500
 
21516
21501
  fireOnDataLoaded();
21517
21502
  });
21518
21503
  }
21519
21504
  }
21520
21505
 
21506
+ function clearData(allowImmediateReload, refreshActionMenu, cb)
21507
+ {
21508
+ Fit.Validation.ExpectBoolean(allowImmediateReload);
21509
+ Fit.Validation.ExpectBoolean(refreshActionMenu);
21510
+ Fit.Validation.ExpectFunction(cb, true);
21511
+
21512
+ // Postpone if WebService operation is currently running
21513
+
21514
+ if (requestCount > 0)
21515
+ {
21516
+ // Data is currently loading - postpone by adding request to process queue
21517
+ onDataLoaded(function() { me.ClearData(cb); });
21518
+ return;
21519
+ }
21520
+
21521
+ // Clear data/cache/state
21522
+
21523
+ hideLinesForFlatData = true; // Make TreeView hide helper lines if nodes received have no children
21524
+ dataRequested = false; // Make data in TreeView reload via ensureTreeViewData() when DropDown is opened
21525
+ autoUpdatedSelections = null; // Remove cached result from AutoUpdateSelected(..) used when multiple calls to the function is made
21526
+
21527
+ // Update action menu
21528
+
21529
+ // Update action menu in case "Show available options" has been disabled, which
21530
+ // will be the case if the previous request returned no data. We need it enabled if
21531
+ // action menu is enabled - otherwise the user won't be able to request updated data.
21532
+ refreshActionMenu && updateActionMenu();
21533
+
21534
+ // Cancel pending search operation if scheduled
21535
+
21536
+ cancelSearch();
21537
+
21538
+ // Invoke callback
21539
+
21540
+ if (Fit.Validation.IsSet(cb) === true)
21541
+ {
21542
+ cb(me);
21543
+ }
21544
+
21545
+ // Immediately load TreeView data if DropDown is open and TreeView is active picker
21546
+
21547
+ if (allowImmediateReload === true && me.IsDropDownOpen() === true && me.GetPicker() === tree)
21548
+ {
21549
+ ensureTreeViewData(); // Will not load anything if callback above triggered data load, e.g. by calling AutoUpdateSelected(..)
21550
+ }
21551
+ }
21552
+
21521
21553
  function showActionMenuIfNoDataReceivedOrOnFirstInteractionIfEnabled()
21522
21554
  {
21523
21555
  // If no data is returned and DropDown is in TextSelectionMode, the user will