Skip to content

Commit

Permalink
JSBridge: Implement MultiLookup.initialTab property
Browse files Browse the repository at this point in the history
Created from PR: 6777
  • Loading branch information
rescocrm committed Jul 3, 2023
1 parent 921e9ed commit 1e0a522
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/JSBridge.d.ts
@@ -1,5 +1,5 @@
// JSBridge.js TypeScript definition file
// (c) 2022 Resco
// (c) 2023 Resco

declare module MobileCRM {

Expand Down Expand Up @@ -2559,6 +2559,7 @@ declare module MobileCRM.UI {
source: MobileCRM.Relationship;
dataSource: Array<MobileCRM.Reference>;
allowNull: boolean;
initialTab: number;

show(success: (obj?: MobileCRM.Reference) => void, failed?: (err: string) => void, scope?: any);
showAsync(): Promise<Reference>;
Expand Down
27 changes: 15 additions & 12 deletions src/JSBridge.js
@@ -1,5 +1,5 @@
(function () {
var _scriptVersion = 16.0
var _scriptVersion = 16.1
// Private objects & functions
var _inherit = (function () {
function _() { }
Expand Down Expand Up @@ -744,6 +744,7 @@
/// <field name="source" type="MobileCRM.Relationship">The entity whose property will be set to the chosen value.</field>
/// <field name="dataSource" type="MobileCRM.Reference[]">The list of entities that should be displayed as selected.</field>
/// <field name="allowNull" type="Boolean">Whether to allow selecting no entity.</field>
/// <field name="initialTab" type="Number">Optional index of the tab which has to be pre-selected - 0=All Items, 1=Selected Items (default).</field>
MobileCRM.UI.MultiLookupForm.superproto.constructor.apply(this, arguments);
this.dataSource = [];
},
Expand Down Expand Up @@ -3852,22 +3853,24 @@
return { entities: this.entities, source: this.source, prevSelection: this.prevSelection, allowedViews: xml, allowNull: this.allowNull, preventClose: this.preventClose };
};

// MobileCRM.UI.MultiLookupForm
_inherit(MobileCRM.UI.MultiLookupForm, MobileCRM.UI.LookupForm);
MobileCRM.UI.MultiLookupForm.prototype.show = function (success, failed, scope) {
/// <summary>Shows a dialog which allows the user to select a list of entities from a configurable list of entity types.</summary>
/// <param name="success" type="function(obj)">The callback function that is called with chosen array of <see cref="MobileCRM.Reference">MobileCRM.Reference</see> objects.</param>
/// <param name="failed" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
/// <param name="scope" type="Object">The scope for callbacks.</param>
var params = this._constructParams();
params.dataSource = this.dataSource;
MobileCRM.bridge.command("multiLookupForm", JSON.stringify(params), success, failed, scope);
};
// MobileCRM.UI.MultiLookupForm
_inherit(MobileCRM.UI.MultiLookupForm, MobileCRM.UI.LookupForm);
MobileCRM.UI.MultiLookupForm.prototype.show = function (success, failed, scope) {
/// <summary>Shows a dialog which allows the user to select a list of entities from a configurable list of entity types.</summary>
/// <param name="success" type="function(obj)">The callback function that is called with chosen array of <see cref="MobileCRM.Reference">MobileCRM.Reference</see> objects.</param>
/// <param name="failed" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
/// <param name="scope" type="Object">The scope for callbacks.</param>
var params = this._constructParams();
params.dataSource = this.dataSource;
params.initialTab = this.initialTab;
MobileCRM.bridge.command("multiLookupForm", JSON.stringify(params), success, failed, scope);
};
MobileCRM.UI.MultiLookupForm.prototype.showAsync = function () {
/// <summary>Shows a dialog which allows the user to select a list of entities from a configurable list of entity types.</summary>
/// <returns type="Promise&lt;MobileCRM.Reference[]&gt;">A Promise object which will be resolved with an array of Reference objects representing chosen entity records.</returns>
var params = this._constructParams();
params.dataSource = this.dataSource;
params.initialTab = this.initialTab;
return MobileCRM.bridge.invokeCommandPromise("multiLookupForm", JSON.stringify(params));
};

Expand Down

0 comments on commit 1e0a522

Please sign in to comment.