i Know editing List view item template and changing
<StackPanel orientation="horizontal"></StackPanel>
Inside the items list will create a horizontal listview. But is there any other simpler way without using listview in winRt to create a Horizontal list.
I personally want to avoid data binding thats why. Please let me know.
Use a scrollviewer and a horizontal stackpanel.
<ScrollViewer VerticalScrollMode="Disabled" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Auto">
<StackPanel x:Name="spContent" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></StackPanel>
</ScrollViewer>
use the Xaml.cs file to load data from code behind. Else you can use binding if you want to.
Related
I am trying to create a custom cell editor that uses a popover to display validation messages. I need to get the scroll container so the popover can move with the cell if the user scrolls inside of the table.
Currently I am able to get it working by finding the container using a hard coded className. I believe this className changes depending on if you have pinned columns so hardcoding is less than ideal. Is there a way to get this element either through the ICellEditorParams or by passing something external in through the cellEditorParams in the ColDef?
<Popover
//#ts-ignore
getPopupContainer={() => document.getElementsByClassName('ag-body-container').item(0)}
style={{position: 'relative'}}
placement="top"
visible={hasErrors}
title={'Error Has Occurred'}
content={this.props.errorResults && this.props.errorResults[0] || ''}
>
<semantic:DetailPage title="Detail Page Title">
<mvc:XMLView viewName="query.sap.view.Table" />
<mvc:XMLView viewName="query.sap.view.chart" />
</semantic:DetailPage>
I have two nested views in the same content and I want to display only one of them. When I press a button, it should switch to the other one.
In order to make only one of the controls visible (in our case one of the child Views), one might be tempted to instantiate all controls first and then use the visible property to hide the other "unneeded" controls. But keep in mind that this approach might lead to performance and memory issues depending on the complexity and the number of elements. According to the linked documentation topic:
Don't use visibility for lazy instantiation
When an application has areas that are not visible initially, or if only one of multiple options is visible at a time, do not create all UI controls and set most of them to non-visible! If you do, OpenUI5 will instantiate and initialize all of those controls, which consumes unnecessary time and memory, even when they are not rendered. On top of this, the data binding will also be initialized, which may trigger back-end requests that are not needed at this stage. The impact is particularly big when the parts of the UI that are not visible initially are complex or numerous.
Luckily, UI5 has already built-in lazy loading features..
Switching Views on Demand
Via NavContainer + Router
Configure the targets property inside the app descriptor file (manifest.json) accordingly as shown in: https://embed.plnkr.co/HRSJ44/
For this, we need three properties for the target object of the child view:
parent: Pointing to a parent target name where the parent view is defined
controlId: The ID of the control in which the child view should be attached.
In the Plunker example above, the control is a NavContainer which also offers a sliding animation as a bonus. The animation can be turned off with transition: "show".
controlAggregation: In our case "pages" (default aggregation of NavContainer).
After defining those three properties, we can either display the target view without changing the hash, or navigate to the child view by calling component.getRouter().navTo("thatChildRouteName");. Either way, the child view will be created lazily and we have a flexible way of switching through different child views.
Via "Blocks" (sap.uxap.BlockBase)
Views can be loaded lazily and switched also with sap.uxap.BlockBase See:
Example: https://embed.plnkr.co/9ZVwpP/
Docs:
Creating Blocks
Object Page Blocks
API reference: sap/uxap/BlockBase
Although Blocks are typically used in conjunction with sap.uxap.ObjectPageLayout (OPL), they can be also used independently from the OPL design in freestyle apps.
I suggest adding a single view. Later, on any chosen event, you can use
sap.m.semantic.SemanticPage.removeContent(vContent) to remove the original view and sap.m.semantic.SemanticPage.addContent() to add the new View.
Link to the relevant SAPUI5 Guide Page
Hope it helps you.
Lets have a switch and save its current value to a local JSON Model. Now, we will use this value to switch between the 2 views. If switch is true, show first view else show second switch.
Below is the code:
XML ( I've just used the texts in place of View (same thing)) :
<Switch state='{/showFirstView}' />
<Text text='TExt 1' visible='{/showFirstView}' />
<Text text='TExt 2' visible='{=!${/showFirstView}}' />
Controller:
onInit: function() {
var model = new sap.ui.model.json.JSONModel({showFirstView:true});
this.getView().setModel(model);
},
and it works. Screenshots:
and :
I have a question here, i need to add some button to the TextView in my tree table header row, the color of Button should be changed according to the line items rows(child nodes) data.
How could that possible? please anyone help me on this.
<TextView id="idKuljkiel" semanticColor="Critical" text="{path:'zstrv_fun>KuljKiel', formatter:'.zchangeColor'}" />
I have created formatter function where i can write some code to create a button, but i am unable to add button to the TextView, and the color of the button should be changed as traffic lights.
For example if childrows have "X" or "" then Yellow,
if childrows have "X" or "X" then Green
if childrows have "" or "" then Red
Can anyone help me on this?
You cannot add a Button or any other control to a TextView. It does not support child controls.
In a formatter you should not modify the view. Its meant to just format a value. It should be idempotent.
The Button control does not support arbitrary colors. It has a style property that lets you change the button to red (reject), green (accept) or gray (default). colors depend on the theme.
Yout can put the TextView together with a Button into a HorizontalLayout. You can then bind the visible property of the Button to your model (and use a formatter if needed).
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.ui.commons" xmlns:l="sap.ui.layout">
...
<l:HorizontalLayout>
<TextView id="idKuljkiel" semanticColor="Critical" text="{path:'zstrv_fun>KuljKiel', formatter:'.zchangeColor'}" />
<Button visible="{path:'zstrv_fun>WhatEver', formatter:'.zbuttonVisible'}" style="{path:'zstrv_fun>Bla', formatter:'.zbuttonStyle'}"/>
</l:HorizontalLayout>
...
</mvc:View>
Dependig on your data structure inside your model it might be possible to bind to the whole row object and use that in the formatter. Otherwise it could be necessary to process the model data after load to calculate additional properties on the header rows.
I need to remove the defualt pagination provided by ZK in one of zul page and add a vertical scroll bar instead. How to achieve this?
Perhaps you are refering to a listbox or a grid component, in that case you probably have something like this:
<listbox id="listbox" mold="paging" pageSize="10">
or
<grid id="grid" mold="paging" pageSize="10">
In both cases, the mold property is making that your component do a pagination, and the pageSize property stablish how many item will be show in every page...
If the component does not have the mold property, zk will put a scrollbar by default (but it can give you an unexpected visual behavior)
If you want to replace the pagination with a scrollbar you can put a css property into your component, like this:
<listbox id="listbox" style="overflow:auto">
You can see an example here
I have a listbox
<ListBox x:Name="lbFamilies" Margin="41,45,38.25,111" ToolTip="Select the tables to seed" ItemsSource="{Binding ManTntFmly.FmlyList}" ItemTemplate="{StaticResource listBoxTemplate}" SelectionMode="Extended"/>
The FmlyList is a Datatable which is bound using DataBinding.
I need to find out all the items
which have been selected from the
listbox. How do I do that using the
view model?
Additionally, how do I get key's to
be passed instead of the values
during the selection?
Here's a link to a post which should answer your question:Multi Select Listbox