SAPUI5 Table shows data only on ABAP Server? - odata

I have created a simple UI5 application which consists of a Table.
The problem is that this table shows data only when I run the application on ABAP Server on other servers, ie. Tomcat or Web App Preview in eclipse it doesn't work. I also tried this application with other open oData services but the table shows no result.
Secondly the table show the data and after it continue to scroll down the data and there comes empty fields from above and data disappears to the down.
Does anyone have any ideas?

Most likely you will be helped with disabeling the same origin policy in google chrome. See:
Disable same origin policy in Chrome.
For a more extensive answer see:
http://scn.sap.com/community/developer-center/front-end/blog/2013/06/29/solving-same-origin-policy-issue-in-different-ways

That usually happened to me when I didn't map the correct field to the "Items" of the table.
You must check both the capitalization and the path of the item in your model.
Here is a short example :
<Table id="idMaterialsList2"
items="{SalesOrder>/Items/results}">
<columns>
<Column>
<Text text="{i18n>Order_product}" />
</Column>
</columns>
<items>
<ColumnListItem type="Navigation">
<ObjectIdentifier
title="{SalesOrder>Product}"
text="{SalesOrder>Description}"/>
</ColumnListItem>
</items>
</Table>
a) Check "items="{SalesOrder>/Items/results}"" the path
b) Check the names of the elements you want to show ""{SalesOrder>Product}""
If a is correct and b is wrong you will have an empty table with X lines where X = SalesOrder>/Items/results.length.
If a is wrong you will see nothing.
Try :)

Related

Maui BazorWebView. Information Needed

I currently trying out Maui and would like to keep the Maui Shell and components as the base platform.
But I have found that the CollectionView with about 20 or 30 complex items becomes almost impossible to scroll and gets odd display issues. So I'm currently looking at doing the more complex displays in Razor. I have been using Razor on the web for a while and have had no problems showing many thousands of items. So 50 or 60 complex display items on a mobile phone should not be a problem.
What I would like to do is not host the whole application in the BlazoeWebView, but just call up a single Razor page at a time in the BlazorWebView by either changing the "HostPage" or the "RootComponents".
<BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
So far I have been unable to find the correct application structure to allow this.
Any information on how to achieve this would be much appreciated.
I figured it out.
Set up an XML namespace with the path to your razor view.
Leave the HostPage at "wwwroot/index.html"
Leave the Selector at Selector="#app"
Set the ContentType to the name of your Razor page.
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="**clr-namespace:Your.Path.To.Razor.Page">
<BlazorWebView HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type view:Razor_Page_Name}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentView>

Dynamic Context Binding in XML

I have odata coming from backend. I have two select controls on my SAPUI5 page. The first select displays a list of items received from the backend. The second select changes depending on what is selected from the first select control.
Right now I am constructing in the controller a new path for "planets" select. Is it possible to change the "planets" items path depending on the "stars" selected item just in the XML? Without using Javascript?
I would like to do something like this:
<Select id="stars"
items="{
path: '/Stars'
}">
<core:Item key="{StarID}" text="{StarName}" />
</Select>
<Select id="planets"
items="{
path: '("/Stars('" + StarID + "')/toPlanets"'
}">
<core:Item text="{PlanetName}" />
</Select>
Unfortunately, I do not believe that there is any existing functionality to do something like this naively in UI5. The only thing that is similar is binding replacement during XML preprocessing, but you cannot use that for your situation.
I have met this situation a lot of times in the past and have created a helper control for dealing with this (might not be the perfect solution, but it works). It only makes sense to use a similar approach if you have this kind of construct in multiple places (so you avoid having the same boilerplate code in your JS controllers).
You can find here an example implementation of such a control and here an example usage. Basically this allows you to have a reusable mechanism for doing such an "indirect binding" without resorting to event listeners.

How to get a list of response fields in YQL

Given the table answers.getquestion; I was under the impression that "desc answers.getquestion" would provide a list of all the possible response fields for querying answers.getquestion. Instead it mentions question_id as a required field.
Where/How do I get a list like the one mentioned in http://developer.yahoo.com/answers/V1/getQuestion.html under response fields? Also, where can I see the mapping identifying question_id in the request to be id in the response?
In YQL, the "desc" command gives a brief summary of the table (ref: YQL docs). In your example, requesting desc answers.getquestion shows some simple info about this table:
<table hash="2143dbc888c9ccf3daac6778d0f57a32"
name="answers.getquestion" security="ANY">
<meta>
<author>James Broad</author>
<documentationURL>http://developer.yahoo.com/answers/V1/getQuestion.html</documentationURL>
<sampleQuery>select * from answers.getquestion where question_id="20090526102023AAkRbch"</sampleQuery>
</meta>
<request>
<select>
<key name="appid" private="true" type="xs:string"/>
<key name="question_id" required="true" type="xs:string"/>
</select>
</request>
</table>
To your question about the response fields, they will come directly through from the Yahoo! Answers Get Question API call. The YQL table is simply a wrapper for the underlying API, and so the results will simply flow back through YQL.
For example, you can see the results from select * from answers.getquestion where question_id="1005120800412" in the YQL console:
<Question xmlns="urn:yahoo:answers" id="1005120800412" type="Answered">
<Subject>Why is there no TITLE tag in the header of answers.yahoo.com?</Subject>
<Content>Come on, you guys. It's not valid HTML if there's no title. :) Correction: there's no TITLE tag in any of the edit screens, including the one I'm using to add these details. Sorry, my bad.</Content>
<Date>2005-12-08 08:22:33</Date>
<Timestamp>1134058953</Timestamp>
etc.
</Question>

Passing variables from a ribbon button to a modal window via POST in Dynamics CRM 2011

I'm attempting to add a button to the Activities grid ribbon to open a modal window that shows all the activities with latlng data on a map.
I have this working ok for a small number of activities, but once the selected number grows too large CRM has problems opening the modal window.
My current theory is that this is because the parameter string is too long to be passed via the GET method.
Is there a way to pass the SelectedControlSelectedItemIds to the web resource using POST rather than GET? I can't see any in TN docs*, but I'm hoping someone might have found a way.
*http://technet.microsoft.com/en-us/library/gg309332.aspx
Here's a snippet of the code I have at the moment:
<CommandDefinition Id="Mscrm.Isv.activitypointer.HomepageGrid.Group0.Control0">
<EnableRules>
<EnableRule Id="Mscrm.Enabled" />
</EnableRules>
<DisplayRules />
<Actions>
<Url Address="$webresource:as_cam_mapsa" WinMode="1" PassParams="true" WinParams="dialogHeight: 800px; dialogWidth: 1000px">
<CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />
</Url>
</Actions>
</CommandDefinition>
Instead of using a html webresource, you could could call a javascript function with no parameters from the ribbon. Inside this javascript you can use something like this to get the selected ids:
document.getElementById("crmGrid").control.get_selectedIds();
Now you can select if you want to use javascript / jQuery or another framework to build the whole dialog - or you can use showModalDialog in javascript to get the same dialog as crm uses. In any term you now have a litle bit more control on how the parameters are sendt.
You should also be able to use the code above inside your html webresources javascript by getting the parent window from dialogArguments that is sent by default to a modal dialog.
window.dialogArguments.window.document.getElementById("crmGrid").control.get_selectedIds();

RADScheduler Appointments not appearing issue in Resource Grouping mode

Hi i am using RAD Scheduler. The Problem is when i bind RAD Scheduler in Resource Grouping mode its not showing Appointments. If i remove resource grouping the scheduler is working fine.
I have two tables one for Projects (Appointments ) and other for Techs ( Resources.). Both table have FK relationship. I tried all possible way of binding ( In Memory DataTable with Custom fields required by Scheduler) and finally i m using Sql Data Sources for Projects ( Appointments) and Techs (Resources.) The FK relationship is defined.
And here is Resource defination
<ResourceTypes>
<telerik:ResourceType DataSourceID="sdsResources" ForeignKeyField="Assignedto"
KeyField="uID" Name="Tech" TextField="UserName" />
</ResourceTypes>
here are two DataSources.
"
SelectCommand="Select * From Techs" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsProjects" runat="server"
ConnectionString="<%$ ConnectionStrings:Mycon %>"
SelectCommand="sched_GetSchedule" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="schedDate" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
Any help will be greatly appreciated.
Thanks
Without seeing your scheduler markup there isn't a lot to go by, but I'll take a shot.
In your markup, you will need explicitely tell the scheduler how you want to show the grouping.
Between your <telerik:RadScheduler> and </telerik:RadScheduler> tags, include the following line:
<TimelineView UserSelectable="true" GroupBy="Tech" GroupingDirection="Vertical" />
You need to set the GroupBy property of your TimelineView tag equal to the Name property of the resource that you wish to group by. In your example, the value is "Tech".
That will allow your grid to visually display the relationship.

Resources