Adding a Field Group to a Fiori Elements Object page - sap-fiori

I am working on a Fiori Elements application which should have a list report page with sales orders and corresponding object pages for each sales order with their items.
This works, but I'm trying to add a field group to the object page, as shown here.
I cannot make it happen to create the field groups or display any of them. I copied the exact code, so it seems as if the error is not in the code itself..?
I'm using Eclipse with ADT to create the cds views and metadata extensions, SAP Web IDE to create a template app, and Fiori 1809. The service is activated in the maint_services transaction.
The annotation file is then successfully transferred from the backend to the front end and loaded within the app, as things like #UI.lineItem: [{ position: 20 }] work perfectly.
I used
#UI.facet: [{
label : 'General Information',
id : 'GeneralInfo',
purpose: #STANDARD,
type : #COLLECTION,
position: 10
},
{
label: 'Basic Data',
id : 'BasicData',
purpose: #STANDARD,
parentId : 'GeneralInfo',
type : #FIELDGROUP_REFERENCE,
targetQualifier : 'BasicData',
position: 20
}]
and
#UI.fieldGroup: [{ position: 20, qualifier: 'BasicData' }]
PSPElement;
both inside of my metadata extension.
Is this the correct approach? (Adding both to the cds view changed nothing..)
I feel like there is something basic I am missing, but I could not figure it out yet. Apart from basic annotations like lineitem and selectionfield, no other annotation worked, so the problem might not be exclusive to field groups.
Thanks for your help :)

Try to add isSummary:true inside the UI.facet as below:
#UI.facet: [{
label : 'General Information',
id : 'GeneralInfo',
isSummary:true,
purpose: #STANDARD,
type : #COLLECTION,
position: 10
},
{
label: 'Basic Data',
id : 'BasicData',
purpose: #STANDARD,
parentId : 'GeneralInfo',
type : #FIELDGROUP_REFERENCE,
targetQualifier : 'BasicData',
position: 20
}]

Related

How to Connect a Find/Search Step to an Update Step

On a zapier-cli application, how do I do to create the Add a search step button next to a dynamic field that will be used to fill the ID of the object about to be updated, like in the image shown below, described on Zapier's documentation here https://zapier.com/help/how-connect-findsearch-step-update-step/ ?
This is my InputField definition:
{
key: "contact_id",
type: "string",
label: 'Contact',
required: true,
helpText: "Pick the contact to update.",
dynamic: "contact.id.name",
altersDynamicFields: false
}
David here, from the Zapier Platform team.
Per the docs you need to add a search property that points to a search key and id property (like findContact.id). That plus dynamic will get you your search button.

VSTS/TFS extension widget tree combo

I'm writing a TFS/VSTS extension widget which uses the VSTS Combo control (documented here) to display a hierarchical data source. For example: Tree of stored queries.
Populating the tree is quite straight forward, such as in the following simplified code. Note that each source item has a unique id property.
var source = [{ text: 'root',
id:1,
children: [ {text:'child 1', id:10},
{text:'child 2', id:20},
{text:'child 3', id:30}
]
}];
var treeOptions = {
type: TreeView.SearchComboTreeBehaviorName,
width: "350px",
sepChar: '>',
source: source,
change: function () {
console.log('selected: ' + this.getValue());
}
};
var combo = Controls.create(Combos.Combo, $(".combo-container"), treeOptions);
I have two questions regarding the combo:
1. When the combo selection changes, How do I get the selected item's id (not the text)?
2. Is there a way to allow only leaf selection?
You can't get the selected item's id directly, you can get the id per to the select text (JSON operation).
It isn't supported to just allow only leaf selection, you may do it with other 3rd control package.

Hide column in Grid at runtime

I have a trouble about hiding columns in a Grid at runtime.
In a project I use a function that returns the configuration of a column in a Grid.
For take the list of my columns in the Grid I use this piece of code:
var cmV = cmpGrid.getView();
var cmH = cmV.getHeaderCt();
var cm = cmH.getGridColumns();
The variable "cm" returns an array with the configured columns in the grid.
When I manually hide a column with the "column" option in the header Grid with ExtJS version 3.4.1 I can get the property
hidden:true
for the configured column.
But with ExtJS 6 the configured column doesn't include this property.
How I can resolve this issue?
Thanks at all in advance,
Lorenzo.
**
UPDATE
**
I have discovered this about my previous question.
With
var cm = cmH.getGridColumns();
I can get the array of the columns in the grid.
Analyzing this array with Firebug I had found the subarray "config" that contains the properties required by the columns for the configuration.
However now this array doesn't reflect more the changed configuration of a column but the default configuration applied.
My first question is if this new behavior is a bug or not.
Because I have found this new behavior I have changed my code to get the properties of a column not from the subarray config but from the radix. However now the possible configurations are so much.
Now my second question is if there is a way to reduce or to have only the principal properties for type of columns in a grid.
Why not just use grid.columns[index].setHidden(true) ?
Or if you want to take the list of columns, how about reconfigure columns.
var tempColumns = [];
// "cm" returns an array with the configured columns in the grid
cm.forEach(function(e) {
if (some conditions) {
tempColumns.push({
xtype: e.xtype,
text: e.text,
dataIndex: e.dataIndex,
hidden: true,
width: e.width,
align: e.align,
format: e.format
});
}
else{
tempColumns.push({
xtype: e.xtype,
text: e.text,
dataIndex: e.dataIndex,
hidden: e.hidden,
width: e.width,
align: e.align,
format: e.format
});
}
});
grid.reconfigre(null, tempColumns);
https://fiddle.sencha.com/#fiddle/17lq

Bonita 7 : Custom Widget property type to support JSON data

I am trying to create a new custom widget in Bonita 7 and I need a Property that can accept JSON data (not simple array collection) i.e., I want to assign below data
[
{
'header1': 'data1-1',
'header2': 'data1-2',
'header3': 'data1-3'
},
{
'header1': 'data2-1',
'header2': 'data2-2',
'header3': 'data2-3'
}
]
I tried all the available property types (text,choice ,html ,integer,boolean ,collection property) & I guess nothing works.
Could someone help me to achieve this.
I am trying to create a Smart-Table custom widget (https://github.com/lorenzofox3/Smart-Table) & I want the table data(rows) to be populated using a variable that is of JSON type.
Is there any other way of achieving this.
Thank you very much for your time
I am very sorry, collection property type actually works
This is what I did:
In the CUSTOM WIDGET EDITOR
1A) created a new property :
name : tableDataCollection
Label: TABLE_DATA
Type: collection (text type also works)
Default value: (trying to assign JSON data here didn't work for me)
1B) In the Controller box, use the property tableDataCollection defined in step 1A:
$scope.data = $scope.properties.tableDataCollection; (inside function ($scope) {})
1C) In the Template box, use the variable data defined in step 1B:
example : <tr ng-repeat="row in data">
2) In the PAGE EDITOR (FORM EDITOR), if you are using the custom widget created in step 1, you will see a new fields on the right related to your custom widget. In my case it is TABLE_DATA
2A) Now, create a new form variable of type JSON.
example : data2Var =
[{
"header1": "data1-1",
"header2": "data1-2",
"header3": "data1-3"
},
{
"header1": "data2-1",
"header2": "data2-2",
"header3": "data2-3"
}]
2B) Now, Assign the variable created in step 2A to your custom widget field.
in my case, I assigned data2Var to TABLE_DATA

Can not select row in subgrid : Jqgrid

I am using jqgrid, and added one subgrid inside it, which looks like as below,
As you can see,
Rows with columns having 11 and 13 are main grid rows
And every row has subgrid having interest,
The Add Record element shows Add Pop up for Subgrid
Here is the code for subgrid looks like,
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+"_t";
pager_id = "p_"+subgrid_table_id;
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"shops?q=2&ShopID="+row_id,
datatype: "xml",
colNames: ['Interest'],
colModel: [
//{name:"Id",index:"ShopID",width:80,editable:false,editoptions:{readonly:false,size:40}}, //Shop ID not required
{name:"id",index:"id",editable:true,edittype:"select",editoptions:{dataUrl:'shops?q=3&ShopID='+row_id},editrules:{required:true}}
],
rowNum:10,
pager: pager_id,
width: '100%',
height: '100%',
scrollOffset: 0,
sortname: 'num',
sortorder: "asc",
height: '100%',
editurl:'shops?q=5&ShopID='+row_id
});
jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:true,del:true})
},
subGridRowColapsed: function(subgrid_id, row_id) {
// this function is called before removing the data
//var subgrid_table_id;
//subgrid_table_id = subgrid_id+"_t";
//jQuery("#"+subgrid_table_id).remove();
}
Problem is , when there are more than one element in subgrid, i can select that (I use latest version of Chrome) but when there is only single element in subgrid surprisingly I can select it ( if you notice the color difference please see subgrid element 'Gifts' -selected below row 13 ) and once select that 'Gifts' can be deleted.
UPDATE:
In firefox and IE , only first row gets selected from subgrid
Is there something wrong in the code ? why can't i select single element when there are more than one elements in subgrid ?
Appreciate your time, thanks
I suppose that you have problem with id duplicates. HTML don't allow to use id attributes on the same HTML pages with the same values. The values of all id attributes must be unique. I recommend you to verify that you have the problem by usage of Developer Tools of Chrome/IE or using Firebug. You need just examine the id attributes which you have now on <tr> elements of grid and subgrids.
On the other side all rows (all <tr> elements) of jqGrid become an id attribute assigned. Typically you have to fill id in the server side in the response of url. The problem is that one use typically the values from id from the database, but you have typically unique id only over one table of the database and not over all tables on the database. So you can easy have the scenario where multiple jqGrids (or grid with subrird) get rows with id duplicates.
The most easy way to fix the problem is to use idPrefix option which was introduced in jqGrid after my suggestion. The main advantage is that you can continue to use the original id values which you have in the database and use id attributes in jqGrid which will be unique because of building id attributes from the id values returned from the server, but with the usage of prefixes. In the answer. So I recommend you to use different idPrefixes for all subgrids. For example you can use idPrefix: 's' + row_id + '_' in subgrid (see the answer and this one).

Resources