class sap.m.TablePersoController

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/m/TablePersoController
Application Component: CA-UI5-CTR

Table Personalization Controller


Constructor

The TablePersoController can be used to connect a table that you want to provide a personalization dialog for, with a persistence service such as one provided by the unified shell.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.m.TablePersoController(sId?, mSettings?)
Param Type Default Value Description
sId? string

optional id for the new control; generated automatically if no non-empty id is given Note: this can be omitted, no matter whether mSettings will be given or not!

mSettings? object

optional map/JSON-object with initial settings for the new component instance


Properties

Name Type Default Value Description
componentName string

Available options for the text direction are LTR and RTL. By default the control inherits the text direction from its parent control.

Visibility: public
contentHeight sap.ui.core.CSSSize Visibility: public
contentWidth sap.ui.core.CSSSize Visibility: public
hasGrouping boolean false Visibility: public
resetAllMode sap.m.ResetAllMode Default

Controls the behavior of the Reset button of the TablePersoDialog.
The value must be specified in the constructor and cannot be set or modified later.
If set to Default, the Reset button sets the table back to the initial state of the attached table when the controller is activated.
If set to ServiceDefault, the Reset button goes back to the initial settings of persoService.
If set to ServiceReset, the Reset button calls the getResetPersData of the attached persoService and uses it to reset the table.

Visibility: public
showResetAll boolean true

Controls the visibility of the Reset button of the TablePersoDialog.

Visibility: public
showSelectAll boolean true Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
_tablePersoDialog 0..1 sap.m.TablePersoDialog
persoService 0..1 Object

Associations

Name Cardinality Type Description
table 0..1 sap.m.Table
tables 0..n sap.m.Table

Also several tables may be personalized at once given they have same columns.


Events Overview

Event Description
personalizationsDone

personalizationsDone

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
activate

Activates the controller, i.e. tries to retrieve existing persisted personalizations, creates a TablePersoDialog for the associated table and attaches a close handler to apply the personalizations to the table and persist them.

This method should be called when the table to be personalized knows its columns. Usually, this is when that table's view has set its model, which is typically done in the corresponding controller's init method. For example


 onInit: function () {

		// set explored app's demo model on this sample
		var oModel = new JSONModel(sap.ui.require.toUrl("sap/ui/demo/mock/products.json"));
		var oGroupingModel = new JSONModel({ hasGrouping: false});
		this.getView().setModel(oModel);
		this.getView().setModel(oGroupingModel, 'Grouping');

		// init and activate controller
		this._oTPC = new TablePersoController({
			table: this.getView().byId("productsTable"),
			//specify the first part of persistence ids e.g. 'demoApp-productsTable-dimensionsCol'
			componentName: "demoApp",
			persoService: DemoPersoService,
		}).activate();
	}

addTable

Adds some table into the association tables.

applyPersonalizations

Applies the personalizations by getting the existing personalizations and adjusting to the table.

attachPersonalizationsDone

Attaches event handler fnFunction to the personalizationsDone event of this sap.m.TablePersoController.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.TablePersoController itself.

destroyPersoService

Destroys the persoService in the aggregation persoService.

detachPersonalizationsDone

Detaches event handler fnFunction from the personalizationsDone event of this sap.m.TablePersoController.

The passed function and listener object must match the ones used for event registration.

exit

Do some clean up: remove event delegates, etc

sap.m.TablePersoController.extend

Creates a new subclass of class sap.m.TablePersoController with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.ManagedObject.extend.

firePersonalizationsDone

Fires event personalizationsDone to attached listeners.

getComponentName

Gets current value of property componentName.

Available options for the text direction are LTR and RTL. By default the control inherits the text direction from its parent control.

getContentHeight

Gets current value of property contentHeight.

getContentWidth

Gets current value of property contentWidth.

getHasGrouping

Gets current value of property hasGrouping.

Default value is false.

sap.m.TablePersoController.getMetadata

Returns a metadata object for class sap.m.TablePersoController.

getPersoService

Gets content of aggregation persoService.

getResetAllMode

Gets current value of property resetAllMode.

Controls the behavior of the Reset button of the TablePersoDialog.
The value must be specified in the constructor and cannot be set or modified later.
If set to Default, the Reset button sets the table back to the initial state of the attached table when the controller is activated.
If set to ServiceDefault, the Reset button goes back to the initial settings of persoService.
If set to ServiceReset, the Reset button calls the getResetPersData of the attached persoService and uses it to reset the table.

Default value is Default.

getShowResetAll

Gets current value of property showResetAll.

Controls the visibility of the Reset button of the TablePersoDialog.

Default value is true.

getShowSelectAll

Gets current value of property showSelectAll.

Default value is true.

getTable

ID of the element which is the current target of the association table, or null.

getTablePersoDialog

Returns a _tablePersoDialog instance if available. It can be NULL if the controller has not been activated yet.

This function makes a private aggregate publicly accessable. This is necessary for downward compatibility reasons: in the first versions of the tablePersoProvider developers still worked with the TablePersoDialog directly, which is now not necessary any longer.

getTables

Returns array of IDs of the elements which are the current targets of the association tables.

init

Initializes the TablePersoController instance after creation.

openDialog

Opens the TablePersoDialog, stores the personalized settings on close, modifies the table columns, and sends them to the persistence service

refresh

Refresh the personalizations: reloads the personalization information from the table perso provider, applies it to the controller's table and updates the controller's table perso dialog.

Use case for a 'refresh' call would be that the table which is personalized changed its columns during runtime, after personalization has been activated.

removeAllTables

Removes all the controls in the association named tables.

removeTable

Removes an table from the association named tables.

savePersonalizations

Persist the personalizations

setComponentName

Using this method, the first part of tablePerso persistence ids can be provided, in case the table's app does not provide that part itself.

If a component name is set using this method, it will be used, regardless of whether the table's app has a different component name or not.

setContentHeight

Reflector for the controller's 'contentHeight' property.

setContentWidth

Reflector for the controller's 'contentWidth' property.

setHasGrouping

Reflector for the controller's 'hasGrouping' property.

setPersoService

Sets the aggregated persoService.

setResetAllMode

Sets a new value for property resetAllMode.

Controls the behavior of the Reset button of the TablePersoDialog.
The value must be specified in the constructor and cannot be set or modified later.
If set to Default, the Reset button sets the table back to the initial state of the attached table when the controller is activated.
If set to ServiceDefault, the Reset button goes back to the initial settings of persoService.
If set to ServiceReset, the Reset button calls the getResetPersData of the attached persoService and uses it to reset the table.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Default.

setShowResetAll

Reflector for the controller's 'showResetAll' property.

setShowSelectAll

Reflector for the controller's 'showSelectAll' property.

setTable

Sets the associated table.

activate

Activates the controller, i.e. tries to retrieve existing persisted personalizations, creates a TablePersoDialog for the associated table and attaches a close handler to apply the personalizations to the table and persist them.

This method should be called when the table to be personalized knows its columns. Usually, this is when that table's view has set its model, which is typically done in the corresponding controller's init method. For example


 onInit: function () {

		// set explored app's demo model on this sample
		var oModel = new JSONModel(sap.ui.require.toUrl("sap/ui/demo/mock/products.json"));
		var oGroupingModel = new JSONModel({ hasGrouping: false});
		this.getView().setModel(oModel);
		this.getView().setModel(oGroupingModel, 'Grouping');

		// init and activate controller
		this._oTPC = new TablePersoController({
			table: this.getView().byId("productsTable"),
			//specify the first part of persistence ids e.g. 'demoApp-productsTable-dimensionsCol'
			componentName: "demoApp",
			persoService: DemoPersoService,
		}).activate();
	}

addTable

Adds some table into the association tables.

Param Type DefaultValue Description
vTable sap.ui.core.ID sap.m.Table

The tables to add; if empty, nothing is inserted

applyPersonalizations

Applies the personalizations by getting the existing personalizations and adjusting to the table.

Param Type DefaultValue Description
oTable sap.m.Table

the table to be personalized.

attachPersonalizationsDone

Attaches event handler fnFunction to the personalizationsDone event of this sap.m.TablePersoController.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.TablePersoController itself.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.m.TablePersoController itself

destroyPersoService

Destroys the persoService in the aggregation persoService.

detachPersonalizationsDone

Detaches event handler fnFunction from the personalizationsDone event of this sap.m.TablePersoController.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

exit

Do some clean up: remove event delegates, etc

sap.m.TablePersoController.extend

Creates a new subclass of class sap.m.TablePersoController with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.ManagedObject.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

firePersonalizationsDone

Fires event personalizationsDone to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getComponentName

Gets current value of property componentName.

Available options for the text direction are LTR and RTL. By default the control inherits the text direction from its parent control.

getContentHeight

Gets current value of property contentHeight.

getContentWidth

Gets current value of property contentWidth.

getHasGrouping

Gets current value of property hasGrouping.

Default value is false.

sap.m.TablePersoController.getMetadata

Returns a metadata object for class sap.m.TablePersoController.

getPersoService

Gets content of aggregation persoService.

getResetAllMode

Gets current value of property resetAllMode.

Controls the behavior of the Reset button of the TablePersoDialog.
The value must be specified in the constructor and cannot be set or modified later.
If set to Default, the Reset button sets the table back to the initial state of the attached table when the controller is activated.
If set to ServiceDefault, the Reset button goes back to the initial settings of persoService.
If set to ServiceReset, the Reset button calls the getResetPersData of the attached persoService and uses it to reset the table.

Default value is Default.

getShowResetAll

Gets current value of property showResetAll.

Controls the visibility of the Reset button of the TablePersoDialog.

Default value is true.

getShowSelectAll

Gets current value of property showSelectAll.

Default value is true.

getTable

ID of the element which is the current target of the association table, or null.

getTablePersoDialog

Returns a _tablePersoDialog instance if available. It can be NULL if the controller has not been activated yet.

This function makes a private aggregate publicly accessable. This is necessary for downward compatibility reasons: in the first versions of the tablePersoProvider developers still worked with the TablePersoDialog directly, which is now not necessary any longer.

getTables

Returns array of IDs of the elements which are the current targets of the association tables.

init

Initializes the TablePersoController instance after creation.

openDialog

Opens the TablePersoDialog, stores the personalized settings on close, modifies the table columns, and sends them to the persistence service

refresh

Refresh the personalizations: reloads the personalization information from the table perso provider, applies it to the controller's table and updates the controller's table perso dialog.

Use case for a 'refresh' call would be that the table which is personalized changed its columns during runtime, after personalization has been activated.

removeAllTables

Removes all the controls in the association named tables.

removeTable

Removes an table from the association named tables.

Param Type DefaultValue Description
vTable int sap.ui.core.ID sap.m.Table

The table to be removed or its index or ID

savePersonalizations

Persist the personalizations

setComponentName

Using this method, the first part of tablePerso persistence ids can be provided, in case the table's app does not provide that part itself.

If a component name is set using this method, it will be used, regardless of whether the table's app has a different component name or not.

Param Type DefaultValue Description
sCompName string

the new component name.

setContentHeight

Reflector for the controller's 'contentHeight' property.

Param Type DefaultValue Description
sHeight sap.ui.core.CSSSize

the new height of the TablePersoDialog.

setContentWidth

Reflector for the controller's 'contentWidth' property.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize

the new width of the tablePersoDialog

setHasGrouping

Reflector for the controller's 'hasGrouping' property.

Param Type DefaultValue Description
bHasGrouping boolean

is the tablePersoDialog displayed in grouping mode or not.

setPersoService

Sets the aggregated persoService.

Param Type DefaultValue Description
oPersoService Object

The persoService to set

setResetAllMode

Sets a new value for property resetAllMode.

Controls the behavior of the Reset button of the TablePersoDialog.
The value must be specified in the constructor and cannot be set or modified later.
If set to Default, the Reset button sets the table back to the initial state of the attached table when the controller is activated.
If set to ServiceDefault, the Reset button goes back to the initial settings of persoService.
If set to ServiceReset, the Reset button calls the getResetPersData of the attached persoService and uses it to reset the table.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Default.

Param Type DefaultValue Description
sResetAllMode sap.m.ResetAllMode Default

New value for property resetAllMode

setShowResetAll

Reflector for the controller's 'showResetAll' property.

Param Type DefaultValue Description
bShowResetAll boolean

is the tablePersoDialog's 'UndoPersonalization' button displayed or not.

setShowSelectAll

Reflector for the controller's 'showSelectAll' property.

Param Type DefaultValue Description
bShowSelectAll boolean

is the tablePersoDialog's 'Display All' checkbox displayed or not.

setTable

Sets the associated table.

Param Type DefaultValue Description
oTable sap.ui.core.ID sap.m.Table

ID of an element which becomes the new target of this table association; alternatively, an element instance may be given