multiple expand in ODATA binding - sapui5

How can I add multiple expands in ODATA binding? toCountry alone works but how also expand toRegion?
oTable.bindAggregation("items", {
path: '/Region_Country',
template: this.byId("CountriesTableTemplate"),
filters: [
new sap.ui.model.Filter({
path: 'toRegion_ID',
operator: "EQ",
value1: sRegionId,
})
],
parameters: [
{ expand: 'toCountry' },
{ expand: 'toRegion' }
]
});

OData binding with $expand
Try
parameters:{
expand: 'toCountry,toRegion'
}

Related

I need to disable advanced table options

I am trying to disable the advanced options of the table, cells and rows and I am applying the code according to the documentation but I am not getting results.
my code is as follows:
tinymce.init({
selector: '#mensaje',
height: 520,
language: 'es_MX',
menubar: false,
plugins: ['table', 'lists'],
toolbar: [
{ name: 'history', items: [ 'undo', 'redo' ] },
{ name: 'formatting', items: [ 'bold', 'italic', 'underline' ] },
{ name: 'alignment', items: [ 'alignleft', 'aligncenter', 'alignright', 'alignjustify' ] },
{ name: 'listas', items: [ 'bullist', 'numlist'] },
{ name: 'tablas', items: [ 'table' ] }
],
table_advtab: false,
table_cell_advtab: false,
table_row_advtab: false
});
Those options seem to work when I load your configuration into a TinyMCE Fiddle:
https://fiddle.tiny.cloud/htiaab
What is different in your environment?

NextJS send data on redirect inside getServerSideProps

Is there a posibility to send data with redirect inside getServerSideProps function similar way as in next.config.js (you cannot pass hidden queries as far as I know inside next config file).
export const getServerSideProps = async (context) => {
const id = context.params.id;
return {
redirect: {
destination: '/my-work',
permanent: false,
has: [
{
type: 'query',
value: id
}
]
},
props: {
}
}
}
I want to pass hidden query to another page so this only works as middleware redirection as I am comming on this page from email template. But has object is not working in getServerSideProps function.
Is there any other ways to achieve that?
Thanks for your help!
This is from the official documentation.
module.exports = {
async redirects() {
return [
// if the header `x-redirect-me` is present,
// this redirect will be applied
{
source: '/:path((?!another-page$).*)',
has: [
{
type: 'header',
key: 'x-redirect-me',
},
],
permanent: false,
destination: '/another-page',
},
// if the source, query, and cookie are matched,
// this redirect will be applied
{
source: '/specific/:path*',
has: [
{
type: 'query',
key: 'page',
// the page value will not be available in the
// destination since value is provided and doesn't
// use a named capture group e.g. (?<page>home)
value: 'home',
},
{
type: 'cookie',
key: 'authorized',
value: 'true',
},
],
permanent: false,
destination: '/another/:path*',
},
// if the header `x-authorized` is present and
// contains a matching value, this redirect will be applied
{
source: '/',
has: [
{
type: 'header',
key: 'x-authorized',
value: '(?<authorized>yes|true)',
},
],
permanent: false,
destination: '/home?authorized=:authorized',
},
// if the host is `example.com`,
// this redirect will be applied
{
source: '/:path((?!another-page$).*)',
has: [
{
type: 'host',
value: 'example.com',
},
],
permanent: false,
destination: '/another-page',
},
]
},
}
You can compare the params with it. For more details, visit here

How to redirect a domain to a locale in NextJS?

My NextJS app has two domains:
eldes.com
eldes.com.br
I would like that eldes.com.br/:path* to redirects to eldes.com/br/:path*
At #juliomalves's suggestion, I came up with this solution:
{
source: '/:path*',
has: [
{
type: 'host',
value: 'eldes.com.br',
},
],
destination: 'https://eldes.com/br/:path*',
permanent: false,
},

Slashes in angular routes

Can you have slashes in angular routes to make it look like subfolders?
I've got this sort of setup
I'd like to makepages at /users/index and /users/groups etc.
In users.routing.module.ts I have:
Shell.childRoutes([
{
path: '', component: IndexComponent, data: { roles: ['Administrator'] },
children: [
{ path: 'users', component: UsersComponent, data: { roles: ['Administrator'] } },
{ path: 'groups', component: GroupsComponent, data: { roles: ['Administrator'] } },
{ path: 'roles', component: RolesComponent, data: { roles: ['Administrator'] } }
]
}
])
];
Howver,
<p><a [routerLink]="users/users">Users</a></p>
makes the link come out as NaN. WTF?
Is it possible to have URLs with slashes in them or do I have to make everything as /component?
It is Nan because you have not defined any route as users/users , try changing one route path as -
{ path: 'users/users', component: UsersComponent, data: { roles: ['Administrator'] } },

All appointments have a different row (sap.m.PlanningCalendar)

I am trying to port my old application with "sap.me.OverlapCalendar" to the new "sap.m.PlanningCalendar", I want to show appointments just for one person. I found a difference in the way the appointments display.
The template I use is:
var oTemplateRow = new sap.m.PlanningCalendarRow("RowTemplate", {
appointments:[
new sap.ui.unified.CalendarAppointment({
startDate: {
path: 'CalendarModel>DateFrom',
formatter: util.Formatter.toStartDate
},
endDate: {
path: 'CalendarModel>DateTo',
formatter: util.Formatter.toEndDate
},
title: "{CalendarModel>CardName} - {CalendarModel>ProjectName}",
text: "Gewerkte uren: {CalendarModel>WorkedHours}",
type: "Type04",
tentative: false,
key: "{CalendarModel>ReportID}"
})]
});
Which is bound to the Calendar control with:
bindAggregation("rows", "CalendarModel>/Items/", oTemplateRow);
The data is showing in the calendar but the way it shows is different.
Old calendar: http://imgur.com/3glZRtT
New calendar: http://imgur.com/snnsWVE
What should I do to get the same output?
You have to change the model: for example, at the root of the model you create an array corresponding to rows of the calendar, and each row should contain an array of appointments.
A sample json file can look like this:
{
"items": [{
"title": "Item1",
"appointments": [{
"text": "appointment1",
"start": "2017-02-17T09:30:00",
"end": "2017-02-17T13:00:00"
}, {
"text": "appointment2",
"start": "2017-02-17T09:45:00",
"end": "2017-02-17T13:10:00"
}]
}, {
"title": "Item2",
"appointments": [{
"text": "appointment3",
"start": "2017-02-17T10:30:00",
"end": "2017-02-17T14:00:00"
}, {
"text": "appointment4",
"start": "2017-02-17T10:45:00",
"end": "2017-02-17T14:10:00"
}]
}]
}
"items" is an array of calendar rows, and each item contains array of appointments. The binding of the control should be more complex. I used such a file a base for JSON model and the controller code looks like this:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("QuickStartApplication.controller.View1", {
onInit: function() {
var oCale = this.getView().byId("PC1");
var oModel = this.getOwnerComponent().getModel("CalendarModel");
this.getView().setModel(oModel, "CalendarModel");
var oTemplateRow = new sap.m.PlanningCalendarRow("RowTemplate", { title: "{CalendarModel>title}" });
oTemplateRow.bindAggregation("appointments", {
path: "CalendarModel>appointments",
template: new sap.ui.unified.CalendarAppointment({
title: "{CalendarModel>text}",
startDate: {
path: "CalendarModel>start",
formatter: this.toDate
},
endDate: {
path: "CalendarModel>end",
formatter: this.toDate
}
}),
templateShareable: true
});
oCale.bindAggregation("rows", {
path: "CalendarModel>/items",
template: oTemplateRow,
templateShareable: true
});
},
toDate: function(sValue) {
if (sValue) {
return new Date(sValue); //
}
}
});
});
Note that first you create a row template and then bind its "appointments" aggregation to the "appointments" property of "CalendarModel" model with template for CalendarAppointment creation. Then you create a binding for calendar rows referring to the row template.