For different facets in object page in List Report, when I add any custom action and add property "requiresSelection" to true, action remains disabled.
Tried adding below code in manifest.json
"Sections": {
"to_PDL::com.sap.vocabularies.UI.v1.LineItem": {
"id": "to_PDL::com.sap.vocabularies.UI.v1.LineItem",
"Actions": {
"TestAction_Deactivate": {
"id": "TestAction_Deactivate",
"text": "Deactivate",
"press": "onDeactivate",
"requiresSelection" : true
}
}
}
}
In the official SAP docu it says for property :
“Property that indicates whether the action requires a selection of items (true) or not (false). The default value is true.”
This means, that first you have to select a row in the table. Then the action becomes enabled.
Does it work for you this way?
Related
I am trying to programmatically create an annotation on a canvas in mirador by calling a javascript function outside mirador.
Basically, I have a textual representation of a scanned text that includes descriptions of certain phenomenon on the scan, such as handwritten additions. If the user clicks on that description, I want the phenomenon in question to be highlighted with a box on the specified canvas in an already opened mirador instance mymirador that has several windows showing different scans.
For this, I try to pass the annotation as JSON using the receiveAnnotation action, but the annotation is not displayed at the correct place.
Javascript (added linebreaks for convenience):
function openAnnotationInMirador() {
var item = '{"id": "url-to-canvas/annotation",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"language": "en",
"value": "Some description"},
"target": "url-to-canvas/#xywh=100,100,200,200"}}';
mymirador.store.dispatch(Mirador.actions.receiveAnnotation('url-to-canvas/annotation', 'url-to-canvas', item));
}
Tha function is triggered by a simple html button with onclick: <button onclick="openAnnotationInMirador()">Mirador Test</button>.
I suspect the JSON to be incorrect, but I am quite at loss here. Any suggestions are very much appreciated!
The third parameter to the receiveAnnotation action creator function has to be a JavaScript object of a WebAnnotation AnnotationPage, with the actual annotation in its items array, in your case:
const annoPage = {
id: 'dummy://my.annotation/page',
type: 'AnnotationPage',
items: [
{
"id": "url-to-canvas/annotation",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"language": "en",
"value": "Some description"},
"target": "url-to-canvas/#xywh=100,100,200,200"
}
}
]
}
When working with the Redux actions in Mirador, it's very useful to install the Redux DevTools Browser Extension with which you can inspect the actions created by Mirador itself.
This is a duplicate of this question. However, nobody has answered it.
So, how can you change a presentation's theme via the API? Is it even possible? I'm using Java, but that shouldn't affect the API.
Thanks
You can do two things:
Import a scheme from a master when creating your presentation - as suggested in the post you are refering to
Change the exsiting theme with a presentations.batchUpdate UpdatePagePropertiesRequest or UpdateShapePropertiesRequest request:
Thereby you can specify theme colors within the update request.
Sample from the documentation:
{
"requests": [
{
"updateShapeProperties": {
"objectId": copyElementId,
"fields": "shapeBackgroundFill.solidFill.color",
"shapeProperties": {
"shapeBackgroundFill": {
"solidFill": {
"color": {
"themeColor": "LIGHT2"
}
}
}
}
}
}
]
}
References:
Pages, Page Elements, and Properties
Kind of properties
ThemeColorType
ColorScheme
PageProperties
PredefinedLayout
I'm using Facebook ComponentsKit to generate my views.
I now am migrating to a "flux" architecture for changing app state and triggering view updates.
The main problem I have is that not all state changes should trigger a UI update. I don't understand the "generic" mechanism to avoid that.
Basically the app state is a "big" "JSON" representing a "view model" (Parsed to native typed objects). The JSON contains all of the view declarations and their initial values. (The JSON is quite complex)
For example a simplified JSON representing a view hierarchy containing a "pager" component and a navigation "next" button :
{
... views ...
{
"pager" : {
"id" : "pager-id-xxx",
"currentPage" : 0,
"pages" : [
....pages....
{},
{},
....pages....
]
},
...
"navigation-next-button" : {
"id" : "navigation-next-button-id-xxxx",
"target" : "pager-id-xxx"
}
},
... views ...
}
My "Flux" abstraction looks like:
// "Action" portion
#interface ChangePageAction
#property id destinationId; // very simplified action. wraps the destination "id"
#end
#implementation ChangePageReducer
-(JSON)reduce:(JSON)initialJSON action:(ChangePageAction *)changePageAction {
// the "reduce" portion finds the node of the pager (in the JSON) and changes the value by +1
// something like:
// find the node in the JSON with the changePageAction.destinationID
Node *nodeCopy = getNodeCopy(initialJSON,changePageAction.destinationId);
replaceValue(nodeCopy,nodeCopy.currentPage + 1);
// according to FLUX doctrine we are supposed to return a new object
return jsonCopyByReplacingNode(nodeCopy); // a new JSON with the updated values
}
// the navigation button triggers the new state
#implementation NavigationNextButton {
id _destination; // the target of this action
FluxStore _store; // the application flux store
}
-(void)buttonPressed {
ChangePageAction *changePage = ...
[_store dispatch:changePage];
}
#end
In my "view controller" I now get a "update state" callback
#implementation ViewController
-(void)newState:(JSON)newJSON {
// here all of the view is re-rendered
[self render:JSON];
//The issue is that I don't need or want to re-render for every action that is performed on the state.
// many states don't evaluate to a UI update
// how should I manage that?
}
#end
Unfortunately, there's no easy way to do this in ComponentKit. React has shouldComponentUpdate, but ComponentKit does not have an equivalent.
The good news is that ComponentKit should be smart enough to rebuild all the components, then realize that nothing has actually changed, and end up making no UIKit changes.
The bad news is that it'll spend a fair amount of CPU doing that.
The datatable has a select method, which selects a given row.
The pager also has a select method, which scrolls to a given page.
However, I cannot find a way to tell the pager to scroll to a page which contains a given row.
Namely, I want to select a row in the datatable, but also show it if the view is on a different page.
There's no specific method that can both select and show the needed row at a time, but the combination of the following methods will do the job well:
datatable.select(35); //selects row
datatable.showItem(35); //scrolls or pages to make the row visible
See at this example in the Snippets
webix.ui({
rows:
[
{ view:"button", type:"iconButton",icon:"fa fa-bolt",label:"Go 52", width:100,on:
{
'onItemClick': function()
{
$$("dTable").select(52);
$$("dTable").showItem(52);
}
}
},
{
view:"datatable",name:"dTable",id:"dTable",select:true,
columns:[
{ id:"rank", header:"", css:"rank", width:50},
{ id:"title", header:"Film title",width:200},
{ id:"year", header:"Released" , width:80},
{ id:"votes", header:"Votes", width:100}
],
autowidth:true,
data: big_film_set
},
]
});
big_film_set it is a variable with a JSON.
var big_film_set = [{"id":1,"title":"The Shawshank Redemption","year":"1994","votes":"678.79","rating":"9.2","rank":"1"} /*...*/ ];
How implement many custom ListItems, like its implemented in standart blackberry calendar app.
The following screenshot shows what I mean
Especially I interested what is the second control with right arrow.
Thanks.
You can have multiple "types" of list items.
Attach your different types of listItemComponents each with a different type. e.g.
listItemComponents: [
ListItemComponent {
type: "itemA"
Container {
Label {
text: ListItemData.title
textStyle.color: Color.Blue
}
}
},
ListItemComponent {
type: "itemB"
Container {
Label {
text: ListItemData.title
textStyle.color: Color.Red
}
}
}
]
Then add this function to your listview (I'm using a property of "mytype" but you could check any property of the data model or even base it on the indexpath):
function itemType(data, indexPath) {
if (data.mytype == "typea") {
return "itemA";
} else {
return "itemB";
}
}
Now when you add your data to your datamodel make sure you specify "mytype" and the listview will automatically use the ListItemComponent for the relative type.
You can easily have different sized list items, different designs even have them work with different data structures.