SAPUI5 sap.ui.table.Table - properties

is there a way to save the columnsettings of a SAPUI5-Table?
if the user logout and relog again the table properties should be saved.
what i have to do is to save the column settings which can be manipulated by user interaction.
Property: showColumnVisibilityMenu:true
i'm using sap.ui.table.Table
var oTable = new sap.ui.table.Table({
title: "Table Example",
selectionMode: sap.ui.table.SelectionMode.Single,
showColumnVisibilityMenu:true, // those settings should be saved
});
actually i've found an example here to preview the selection of the columns (hide or show):
http://jsbin.com/ceduc/1/edit?html,js,output
So when the user decides to hide the column "Key1 Label" (figure below) and want to logout and relog again, the column shouldn't be visible. the configuration of the table columns should be saved for a user. how to do that?

It depends on how exactly do you want to persist the view settings and on what backend you have.
If you have an ABAP backend which has the unified shell services (delivered as part of Fiori), then you can use the standard Personalization controller / services to persist the settings. See this demo, the UI5 documentation and the unified shell service docu.
If you have any other type of backend or you don't want to use the personalization services, then you should save the visibility of the columns inside a (dedicated) model. Then you can save the content of this model on your backend (by simply sending it to a dedicated REST service and persisting it e.g. in the database). When the user logs back in, you can read this model and simply restore it.
Another possibility would be to save it in the local storage of the browser. You still need the model from above, but instead of sending the data to the backend via AJAX, you simply save it to the local storage and load it from there when needed.

You can make use of SAP's standard Shell personalization Service.
Here is how I would do it.
Use Personalization Dialog (sap.m.P13nDialog) for managing Table's options
Get standard personalization service provider
var oProvider = sap.ushell.Container.getService("Personalization").getPersonalizer(oPersId);
Connect your table with personalization provider and activate
var oTablePersoController = new sap.m.TablePersoController({
table: oTable,
persoService: oProvider }).activate();
This will automatically take care of saving and retrieving variants/personalization.
Launch the Personalization Dialog upon user cliking the corresponding button
You may use sap.ui.table.TablePersoController for sap.ui.table.Table

Related

How to remove sign-in restriction from Google Form programmatically?

I am creating Google Forms programmatically with a Google Script project.
DriveApp is used to grant view access to anyone with a link.
var form = FormApp.create("Test form");
var formFile = DriveApp.getFileById(form.getId());
formFile.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
However the Form still requires "anyone" to sign-in and it's restricted to my G Suite domain users. I've tried to find how to disable this but I don't know how the feature is even called in Google Scripts.
See the attached image with a checked box:
Note: I can disable the sign-in requirement manually. But Forms are delivered to respondents automatically and there's no time to do this manual step.
I haven't had to do this, so I'm not sure if it's what you need, but have you tried using the setRequireLogin(requireLogin) method when creating your forms?
See https://developers.google.com/apps-script/reference/forms/form#setRequireLogin(Boolean)

Sensenet: Pagination on Document Library

It is possible to define pagination on document library?
I have a document library with more that 10000 documents... when I open the library occurs an timeout.
Actually SenseNet already does this! They just don't deliver it in the standard list control. If you open up the PRC and navigate to /Root/IMS/BuiltIn/Portal you'll see a list control with paging. The code can be found at /Root/Global/renderers/UserExploreGrid.ascx as User Control portlet. You can copy the code and change it to meet your needs.
Our company prefers to create User Control portlets and use Datatables with calls to the SenseNet OData API using skip and top to deliver pages.
Finally, given that SenseNet Content is stored as a tree structure (in SQL!), you can move the Content after creation so that data is organized hierarchically. A common solution is to take the first letter of the DisplayName and create a sub-folder from that letter, thereby reducing the number of items at a single node.
Here's what the paging looks like:
The short answer is no. Right now there isn't a built in functionality for that.
The long answer is that you can make a pagination yourself. One of the core member of sensenet made a grid where you can use pagination. It won't work with the current free to use releases because they lack the js files she used. But the idea behind it, is using a custom view. Which you can achieve by adding a system folder named Views under a the Document library and adding your custom view there.
You can use this grid for Explore, just follow these steps:
Go to the Explore action page, and switch editor mode on the PRC.
Place a ClientContext portlet (this can find under the Portlets->Application section in the portlet picker dialog) to the Wide column. Set portlet (client context porlet) properties, Apparance to None. It is a technical portlet, which allow get the CurrentContext in javascript. This is a very important element to work with this grid. The Grid use the client context.
Place a UserControlPortlet (In the portlet picker, Portlets->Application section) to the Wide Column.
Set portlet properties:
4.1. Portlet title: <%$ Resources: PortletTitles, Items%>
4.2. User Control path: /Root/Global/renderers/UserExploreGrid.ascx
Checkin Page modification on the PRC.
Enjoy your pageable explore portlet.
Keep in mind that this grid is specifically designed for users, so they will miss actions in the top menu. These must be handwritten. Then I suggest you copy the UserControl ( /Root/Global/renderers/UserExploreGrid.ascx)
and then put the action list on it . You can read more info about action list here: http://wiki.sensenet.com/ActionList
Br,
maros

Where does Odoo save the contents of My Dashboard

I need to know where Odoo saves the views that will be shown in (My Dashboard) when we click (Add to My Dashboard).
I looked in the table scheme and I could only find one related table: board_create
which is used to save the custom dashboards the user creates.
But I only want to find out where the contents (the views not the data) of the default Dashboard are saved in the database.
In OpenERP 7 and 8 you can find the view for dashboard in 'ir_ui_view_custom' table.
The view will be saved inside 'arch' column.
From OpenERP web interface this is will happened when you click 'add to my dashboard'
Javascript will invoke 'add_dashboard'
Javascript will make rpc request using '/board/add_to_dashboard' to openerp server
Openerp server will invoke "add_to_dashboard" function
Openerp server will save the view inside 'ir_ui_view_custom' table
Openerp use these files to process 'add to my dashboard'
/OpenErp7/addons/board/static/src/js/dashboard.js
/OpenErp7/src/main/openerp/addons/board/controllers.py
I hope this help.

How to restore/load a DB saved state in Datatables?

I am using stateSaveCallback to save a Datatables state into the database. It submits the current state via AJAX to a script so I can save the JSON.
I can attach the save function to a button click like so:
$( ".save_state" ).click(function(e) {
e.preventDefault();
table.state.save();
});
But I cannot find any documentation on how to restore or load that script using a click. The closest reference I can find is on this page
https://datatables.net/reference/api/state.loaded() which references restoring the saved state.
I am using stateLoadCallback but I think this just does it on load. I would like to do it via a click, so users can save their state in the database and click restore to load it back later (we will offer multiple state saves, like a Saved Search, so they click to restore a saved search).
Thanks
After inspecting the source code, it looks like state loading is performed only once during initialization. Therefore your best bet is to use destroy option as destroy: true and re-initialize your data table on click.
I assume you have defined a callback using stateLoadCallback option that query the server upon re-initialization.

SPWebPartManager to hide webparts per user

Can I use SPWebPartManager to hide Web Parts per user programmatically?
Such as: Get the SPWebPartManager instance, iterate through the Web Parts, and set visible = false depending on the user.
I heard from somewhere there when you set webpart.visible = false this sets this for all the users, is this true?
You need to open the Web Part in the user scope in order to update user specific properties. Use the PersonalizationScope Enumeration to open the SPLimitedWebPartManager accordingly:
SPWeb web = // ...
using (SPLimitedWebPartManager mgr = web.GetLimitedWebPartManager(
"<path to page>",
PersonalizationScope.User))
{
WebPart wp = mgr.WebParts[<ID of the web part to update>];
wp.Hidden = true; // hide the web part.
mgr.SaveChanges(wp);
}
Note: In order to update a peropery in the PersonalizationScope.User the property needs to be marked as personal web part storage ([WebPartStorage(Storage = Storage.Personal)]):
MSDN description for the User PersonalizationScope scope:
When referring to the scope on the WebPartManagercontrol, User scope means that personalization data that is user-specific, as well as personalization data that applies to all users, is loaded for all personalizable controls on a page. Only personalization data that is user-specific can be saved on the page.
When referring to the scope associated with a Web Parts control property, User scope indicates that the property can only load and store data applicable to all users when running on a page in Shared scope. However, when the property's control is running on a page in User scope, the property's per-user and all-user data will be loaded and merged. In this case, though, only per-user data will be saved when a page is running in User scope.