SAPUI5 : data from JSON not displayed in detail view page without errors in the developper tools - data-binding

I'm trying to display the data of a JSON file into the detail view page. When I click on an item of the table, the details of this item should be displayed in the detail view page, but it don't. As I'm new to SAP UI 5, I don't understand what are the reasons for this mistake.
But in the developper tools, I can see the arrays of my data.
Can anyone explain me the cause of this error please ?
I searched for some solutions and this is what I did for the moment.
main.view.xml:
<Table id="tab1" items="{path: '/Articles'}">
<columns>
<Column width="11rem">
<Label text="ID" />
</Column>
<Column width="11rem">
<Label text="Description" />
</Column>
<Column width="11rem">
<Label text="Date début de validité" />
</Column>
<Column width="11rem">
<Label text="Date fin de validité" />
</Column>
<Column width="11rem">
<Label text="Montant" />
</Column>
</columns>
<ColumnListItem press=".onPress" type="Navigation">
<cells>
<Text text="{id}" />
<Text text="{description}" />
<Text text="{debutValidite}" />
<Text text="{finValidite}" />
<Text text="{prix}" />
</cells>
</ColumnListItem>
</Table>
main.controller.js:
onPress: function (oEvent) {
var oItem = oEvent.getSource();
console.log(oItem);
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("detail", {
ID: oItem.getBindingContext().getProperty("id")
});
},
detail.view.xml:
<content>
<f:SimpleForm id="form1" editable="false" layout="ResponsiveGridLayout" labelSpanL="3" labelSpanM="3" emptySpanL="4" emptySpanM="4"
columnsL="1" columnsM="1">
<f:content>
<Label text="ID"/>
<Text text="{id'}"/>
<Label text="Description"/>
<Text text="{description}"/>
<Label text="Date début de validité"/>
<Text text="{debutValidite}"/>
<Label text="Date fin de validite"/>
<Text text="{finValidite}"/>
<Label text="Montant"/>
<Text text="{prix}"/>
</f:content>
</f:SimpleForm>
</content>
detail.controller.js:
onInit: function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.getRoute("detail").attachPatternMatched(this._onObjectMatched, this);
},
_onObjectMatched: function (oEvent) {
var sObjectPath = "/Articles/"+oEvent.getParameter("arguments").ID;
this._bindView(sObjectPath);
console.log(sObjectPath);
},
_bindView: function (sObjectPath) {
var oView = this.getView();
oView.bindElement(sObjectPath);
console.log(oView.bindElement(sObjectPath));
},
onBack: function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("main");
}
In the Component.js file :
var oModel = new JSONModel();
oModel.loadData("./model/Articles.json");
this.setModel(oModel);
In the manifest.json file:
"routes": [{
"name": "main",
"pattern": "",
"target": "main"
}, {
"name": "detail",
"pattern": "detail/{ID}",
"target": "detail"
}],
"targets": {
"main": {
"viewName": "main",
"viewLevel": 1
},
"detail": {
"viewName": "detail",
"viewLevel": 2
}
}
Articles.json:
{
"Articles": [{
"id": "AR00000111",
"description": "Pièce de rechange",
"debutValidite": "01.02.2020",
"finValidite": "01.05.2021",
"prix": "150"
}, {
"id": "AR00000112",
"description": "Chaise",
"debutValidite": "01.03.2020",
"finValidite": "01.05.2021",
"prix": "200"
}, {
"id": "AR00000113",
"description": "Pièce de rechange",
"debutValidite": "01.02.2020",
"finValidite": "01.09.2021",
"prix": "250"
}
]
}
developper_tools_1.png
developper_tools_2.png
main_view.png
detail_view.png

In your Detail.view.xml, could you try to remove the single quote in your text element ?
<Label text="ID"/>
<Text text="{id'}"/>
{id'} => {id}
<Label text="ID"/>
<Text text="{id}"/>
Check if it works now.

Related

React Admin Sign up page can't access

I have created a custom sign up page that i am trying to access from a custom login screen. I am using the firebase connecters for authProvider. How can I allow the page to go to the sign up page without being authenticated?
Here is the app.tsx:
function App() {
return (
<Admin
authProvider={firebaseAuthProvider}
dataProvider={firebaseDataProvider}
i18nProvider={i18nProvider}
loginPage={LoginPage}
>
<Resource name="researchers" list={ListGuesser} />
<CustomRoutes noLayout>
<Route path="/signup" element={<SignUpPage />} />
</CustomRoutes>
</Admin>
);
}
And the login page:
import React from "react";
import {
Stack,
Card,
CardContent,
Typography,
TextField,
Button,
Link,
} from "#mui/material";
import { Title, useTranslate } from "react-admin";
export const LoginPage = () => {
const t = useTranslate();
const handleSubmit = () => {};
return (
<Card>
<Title title="Sign Up!" />
<CardContent>
<Stack>
<Stack alignItems="center">
<Typography>{t("login.login")}</Typography>
</Stack>
<Stack component="form" onSubmit={handleSubmit}>
<TextField
margin="normal"
required
fullWidth
id="email"
label={t("email")}
name="email"
autoComplete="email"
autoFocus
/>
<TextField
margin="normal"
required
fullWidth
name="password"
label={t("password")}
type="password"
id="password"
autoComplete="current-password"
/>
<Button
type="submit"
fullWidth
variant="contained"
sx={{ mt: 3, mb: 2 }}
>
{t("login.signin")}
</Button>
</Stack>
<Typography>{t("login.or")}</Typography>
<Link href="/signup">{t("signup.signup")}</Link>
</Stack>
</CardContent>
</Card>
);
};
The link on the login page is where the problem is.
I faced the same problem and kind of sorted it out. I think it's a problem with RAF. By default you don't need to write extra codes to make it work.
I have posted here.

Xamarin Forms Custom Content View (Composite Control) Implicit Style Error

This seems like something that should be simple but I have been unable to locate a solution for it.
I have the following defined in my sample project:
ReadOnlyField.xaml
<?xml version="1.0" encoding="UTF-8"?>
<ContentView x:Name="ReadOnlyFieldContentView" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TabbedPageDemo.Views.ReadOnlyField">
<StackLayout Spacing="4">
<Label FontSize="{Binding Source={x:Reference ReadOnlyFieldContentView}, Path=HeaderFontSize}" Text="{Binding Source={x:Reference ReadOnlyFieldContentView}, Path=HeaderText}" />
<Label FontSize="{Binding Source={x:Reference ReadOnlyFieldContentView}, Path=DetailFontSize}" Text="{Binding Source={x:Reference ReadOnlyFieldContentView}, Path=DetailText}" />
</StackLayout>
</ContentView>
ReadOnlyField.xaml.cs
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace TabbedPageDemo.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ReadOnlyField : ContentView
{
#region Fields
private static readonly BindableProperty DetailFontSizeProperty;
private static readonly BindableProperty DetailTextProperty;
private static readonly BindableProperty HeaderFontSizeProperty;
private static readonly BindableProperty HeaderTextProperty;
#endregion
#region Constructors
static ReadOnlyField()
{
DetailFontSizeProperty = BindableProperty.Create("DetailFontSize", typeof(double), typeof(ContentView), 12.0);
DetailTextProperty = BindableProperty.Create("DetailText", typeof(string), typeof(ContentView), null);
HeaderFontSizeProperty = BindableProperty.Create("HeaderFontSize", typeof(double), typeof(ContentView), 14.0);
HeaderTextProperty = BindableProperty.Create("HeaderText", typeof(string), typeof(ContentView), null);
}
public ReadOnlyField()
{
InitializeComponent();
}
#endregion
#region Properties
public double DetailFontSize
{
get => (double) GetValue(DetailFontSizeProperty);
set => SetValue(DetailFontSizeProperty, value);
}
public string DetailText
{
get => (string) GetValue(DetailTextProperty);
set => SetValue(DetailTextProperty, value);
}
public double HeaderFontSize
{
get => (double) GetValue(HeaderFontSizeProperty);
set => SetValue(HeaderFontSizeProperty, value);
}
public string HeaderText
{
get => (string) GetValue(HeaderTextProperty);
set => SetValue(HeaderTextProperty, value);
}
#endregion
}
}
Page2.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:v="clr-namespace:TabbedPageDemo.Views" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TabbedPageDemo.Views.Page2">
<ContentPage.Resources>
<Style TargetType="v:ReadOnlyField">
<!-- <Setter Property="HeaderFontSize" Value="14" /> -->
<!-- <Setter Property="DetailFontSize" Value="12" /> -->
</Style>
</ContentPage.Resources>
<ScrollView x:Name="ScrollView1" Padding="4">
<StackLayout x:Name="StackLayout0">
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 1" DetailText="Detail 1" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 2" DetailText="Detail 2" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 3" DetailText="Detail 3" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 4" DetailText="Detail 4" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 5" DetailText="Detail 5" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 6" DetailText="Detail 6" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 7" DetailText="Detail 7" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 8" DetailText="Detail 8" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 9" DetailText="Detail 9" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 10" DetailText="Detail 10" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 11" DetailText="Detail 11" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 12" DetailText="Detail 12" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 13" DetailText="Detail 13" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 14" DetailText="Detail 14" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 15" DetailText="Detail 15" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 16" DetailText="Detail 16" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 17" DetailText="Detail 17" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 18" DetailText="Detail 18" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 19" DetailText="Detail 19" />
<v:ReadOnlyField HeaderFontSize="14" DetailFontSize="12" HeaderText="Header 20" DetailText="Detail 20" />
</StackLayout>
</ScrollView>
</ContentPage>
If I uncomment either of the two lines in the <Style> element, I get the following error:
Can't resolve *propertyName* on ReadOnlyField
What I would like to do is use an implicit style such as the one I am attempting to define so that I don't have to specify property values many times over.
What am I missing / doing wrong?
The error is caused by the Access Modifiers.
Please change private to public.
Change:
private static readonly BindableProperty DetailFontSizeProperty;
private static readonly BindableProperty DetailTextProperty;
private static readonly BindableProperty HeaderFontSizeProperty;
private static readonly BindableProperty HeaderTextProperty;
To:
public static readonly BindableProperty DetailFontSizeProperty;
public static readonly BindableProperty DetailTextProperty;
public static readonly BindableProperty HeaderFontSizeProperty;
public static readonly BindableProperty HeaderTextProperty;
And you could define an style using the x:Key attribute like below. The property should match the BindableProperty you defined.
<ContentPage.Resources>
<Style x:Key="ReadOnlyFieldStyle" TargetType="v:ReadOnlyField">
<Setter Property="HeaderFontSize" Value="14" />
<Setter Property="DetailFontSize" Value="12" />
<!--<Setter Property="HeaderText" Value="Header1"></Setter>
<Setter Property="DetailText" Value="Detail"></Setter>-->
</Style>
And use the style.
<v:ReadOnlyField Style="{Binding StaticResource ReadOnlyFieldStyle}" HeaderText="Header 1" DetailText="Detail 1"></v:ReadOnlyField>
<v:ReadOnlyField Style="{Binding StaticResource ReadOnlyFieldStyle}" HeaderText="Header 2" DetailText="Detail 2"></v:ReadOnlyField>
Result:

How to binding the DataContext of an user-control?

I have a user-control like this:
<UserControl x:Class="IPAddressWPFUserControl.IPAddressControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" BorderThickness="0" OverridesDefaultStyle="False" BorderBrush="{x:Null}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" x:Name="txtboxFirstPart" TextChanged="txtbox_TextChanged" MaxLength="3" BorderThickness="0" TabIndex="1" PreviewKeyDown="txtboxFirstPart_PreviewKeyDown" PreviewKeyUp="txtboxFirstPart_PreviewKeyUp" Width="31" />
<Label Content="." Grid.Column="1" x:Name="label1" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Background="White" />
<TextBox Grid.Column="2" x:Name="txtboxSecondPart" MaxLength="3" TextChanged="txtbox_TextChanged" BorderThickness="0" TabIndex="2" KeyDown="txtboxSecondPart_KeyDown" PreviewKeyUp="txtboxSecondPart_PreviewKeyUp" Margin="0" HorizontalAlignment="Left" Width="31"/>
<Label Content="." Grid.Column="3" Grid.Row="0" x:Name="label2" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Background="White" />
<TextBox Grid.Column="4" x:Name="txtboxThridPart" MaxLength="3" TextChanged="txtbox_TextChanged" BorderThickness="0" TabIndex="3" VerticalContentAlignment="Bottom" KeyDown="txtboxThridPart_KeyDown" PreviewKeyUp="txtboxThridPart_PreviewKeyUp" Width="31" HorizontalContentAlignment="Center" />
<Label Content="." Grid.Column="5" x:Name="label3" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Background="White" />
<TextBox Grid.Column="6" x:Name="txtboxFourthPart" MaxLength="3" TextChanged="txtbox_TextChanged" BorderThickness="0" TabIndex="4" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Width="31" HorizontalContentAlignment="Center" />
</Grid>
Added Text property to it in the code behind:
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(IPAddressControl),
new PropertyMetadata("0.0.0.0", new PropertyChangedCallback(OnTextPropertyChanged)));
private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
IPAddressControl o = d as IPAddressControl;
try
{
var value = e.NewValue as string;
var splitValues = new string[4];
if (value != null)
{
var splits = value.Split(new char[] { '.' }, StringSplitOptions.None);
Array.Copy(splits, splitValues, splits.Length);
}
o.txtboxFirstPart.Text = splitValues[0];
o.txtboxSecondPart.Text = splitValues[1];
o.txtboxThridPart.Text = splitValues[2];
o.txtboxFourthPart.Text = splitValues[3];
}
catch (Exception ex)
{
throw new Exception("Error in IP control see inner exception!", ex);
}
o.RaiseTextChanged(e);
}
public string Text
{
get { return (string)this.GetValue(IPAddressControl.TextProperty); }
set { this.SetValue(IPAddressControl.TextProperty, value); }
}
public event DependencyPropertyChangedEventHandler TextChanged;
protected virtual void RaiseTextChanged(DependencyPropertyChangedEventArgs e)
{
if (this.TextChanged != null)
{
this.TextChanged(this, e);
}
}
When I am using it in the MainWindow like this:
<GroupBox Name="gb_Tcp" DataContext="{Binding TcpCollection}">
<my:IPAddressControl x:Name="tb_IpAddress" Text="{Binding Path=IpAddress, ElementName=gb_tcp}"/>
<TextBox x:Name="tb_Test" Text={Binding Path=IpAddress, ElementName=gb_tcp}" />
</GroupBox>
The problem is when I try to set the value in a button click event:
private void btn_IpReset_Click(object sender, RoutedEventArgs e)
{
tb_IpAddress.Text = source.IpAddress; //This failed to change
tb_Test.Text= source.IpAddress; //This changed successfully
}
I suppose this is because the user-control didn't change the datacontext to the MainWindow's? Or what could be the problem is? Thanks in advance!
It's because you didn't use a BindingMode that will update source like TwoWay or OneWayToSource. So, after tb_IpAddress.Text = source.IpAddress, the binding you have set will be overwrite by the local value. tb_Test.Text= source.IpAddress work because TextBox.Text's default binding mode is TwoWay.

Flex 3: Possible to add a Context Menu to a ItemRenderer inside a DataGrid?

I have an ItemRenderer that is shared by several applications (inside a DataGrid), and I would like to add a context menu to it (rather than in each application). The renderer is derived from the Canvas class, and the code to create the context menu looks something like:
var menuItem:ContextMenuItem = new ContextMenuItem("Test");
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextCallback);
var customContextMenu:ContextMenu = new ContextMenu();
customContextMenu.hideBuiltInItems(); //hide flash menu
customContextMenu.customItems.push(menuItem);
this.contextMenu = customContextMenu;
However, when I right click on the cell in the datagrid, I get the default Flash Context Menu. Is this not possible?
Edit: Here is a fully runnable example, which doesn't show the context menu's:
Application.mxml:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Model id="items">
<items>
<item label="Item 1" data="i001" propertyA="Item 1.A" propertyB="Item 1.B" />
<item label="Item 2" data="i002" propertyA="Item 2.A" propertyB="Item 2.B" />
<item label="Item 3" data="i003" propertyA="Item 3.A" propertyB="Item 3.B" />
<item label="Item 4" data="i004" propertyA="Item 4.A" propertyB="Item 4.B" />
<item label="Item 5" data="i005" propertyA="Item 5.A" propertyB="Item 5.B" />
<item label="Item 6" data="i006" propertyA="Item 6.A" propertyB="Item 6.B" />
<item label="Item 7" data="i007" propertyA="Item 7.A" propertyB="Item 7.B" />
<item label="Item 8" data="i008" propertyA="Item 8.A" propertyB="Item 8.B" />
</items>
</mx:Model>
<mx:DataGrid id="dataGrid" width="400" dataProvider="{items.item}">
<mx:columns>
<mx:DataGridColumn headerText="No Menu" dataField="label" />
<mx:DataGridColumn headerText="Menu" dataField="propertyA" itemRenderer="canvasRenderer"/>
</mx:columns>
</mx:DataGrid>
canvasRenderer.mxml:
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" resize="this.setSize()" creationComplete="init()" implements="mx.controls.listClasses.IDropInListItemRenderer">
<mx:Script>
<![CDATA[
import mx.controls.listClasses.ListData;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.events.FlexEvent;
private var _listData:DataGridListData;
private function init():void {
var menuItem:ContextMenuItem = new ContextMenuItem("Copy", true);
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function():void {
trace("selected");
});
var menu:ContextMenu = new ContextMenu();
menu.hideBuiltInItems(); //hide flash menu
menu.customItems.push(menuItem);
this.contextMenu = menu;
}
public override function set data(value:Object):void {
super.data = value;
if(_listData && myLabel) {
var text:String = _listData.label ? _listData.label : value[_listData.dataField];
myLabel.text = text;
myLabel.toolTip = text;
}
}
public function get listData():BaseListData { return _listData; }
public function set listData(value:BaseListData):void { _listData = DataGridListData(value); }
public function setSize():void { myLabel.width = this.width; }
]]>
</mx:Script>
<mx:Label id="myLabel" truncateToFit="true"/>
This works:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
[Bindable] public var cm1:ContextMenu;
[Bindable] public var cm2:ContextMenu;
private function init():void {
var cmi1:ContextMenuItem = new ContextMenuItem("View item in column 1...", true);
cmi1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItem_menuItemSelect);
cm1 = new ContextMenu();
cm1.hideBuiltInItems();
cm1.customItems = [cmi1];
cm1.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelect);
var cmi2:ContextMenuItem = new ContextMenuItem("View item in column 2...", true);
cmi2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItem_menuItemSelect);
cm2 = new ContextMenu();
cm2.hideBuiltInItems();
cm2.customItems = [cmi2];
cm2.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelect);
}
private function contextMenu_menuSelect(evt:ContextMenuEvent):void {
dataGrid.selectedIndex = lastRollOverIndex;
}
private function contextMenuItem_menuItemSelect(evt:ContextMenuEvent):void {
var obj:Object = dataGrid.selectedItem;
Alert.show("Property A: " + obj.propertyA + "\n" + "Property B: " + obj.propertyB, obj.label, Alert.OK);
}
]]>
</mx:Script>
<mx:Model id="items">
<items>
<item label="Item 1" data="i001" propertyA="Item 1.A" propertyB="Item 1.B" />
<item label="Item 2" data="i002" propertyA="Item 2.A" propertyB="Item 2.B" />
<item label="Item 3" data="i003" propertyA="Item 3.A" propertyB="Item 3.B" />
<item label="Item 4" data="i004" propertyA="Item 4.A" propertyB="Item 4.B" />
<item label="Item 5" data="i005" propertyA="Item 5.A" propertyB="Item 5.B" />
<item label="Item 6" data="i006" propertyA="Item 6.A" propertyB="Item 6.B" />
<item label="Item 7" data="i007" propertyA="Item 7.A" propertyB="Item 7.B" />
<item label="Item 8" data="i008" propertyA="Item 8.A" propertyB="Item 8.B" />
</items>
</mx:Model>
<mx:Number id="lastRollOverIndex" />
<mx:DataGrid id="dataGrid" width="400" dataProvider="{items.item}">
<mx:columns>
<mx:DataGridColumn headerText="Label">
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{data.label}" contextMenu="{outerDocument.cm1}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Property A">
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{data.propertyA}" contextMenu="{outerDocument.cm2}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Label text="{dataGrid.selectedItem.label}" />
</mx:Application>
I've added the context menu to an itemRenderer in a List with the Flextras DataSorter. However, I don't see any difference between what I did and what you're doing.
Source code here:
http://www.flextras.com/DataSorter/Samples/RightClick/srcview/index.html
and the running Sample
http://www.flextras.com/DataSorter/Samples/RightClick/
Can you share more code? What is the "this" that you're adding the context menu too? Is your temRenderer in-line or a separate component?

LINQ TO SQL Mapping Error

Iam using LINQ To SQL with POCO's and XML mapping. I am getting the following error when I try to run the application: Cannot find type 'MyProject.DataTransfer.User' from mapping.
Below is the mapping:
<Table Name="Users" Member="User">
<Type Name= "MyProject.DataTrasnfer.User">
<Column Name="UserID" Member="UserID" DbType="Int NOT NULL IDENTITY" IsDbGenerated="true"
IsPrimaryKey="true"/>
<Column Name="UserName" Member="UserName" DbType="nvarchar(100) NOT NULL" />
<Column Name="Password" Member="Password" DbType="nvarchar(32)"/>
<Column Name="IsActive" Member="IsActive" DbType="bit NOT NULL"/>
<Column Name="InsertedBy" Member="InsertedBy" DbType="Int NOT NULL" />
<Column Name="InsertedDate" Member="InsertedDate" DbType="DateTime NOT NULL" />
<Column Name="UpdatedBy" Member="UpdatedBy" DbType="Int NOT NULL" />
<Column Name="UpdatedDate" Member="UpdatedDate" DbType="DateTime NOT NULL" />
<Column Name="Version" Member="Version" DbType="rowversion NOT NULL" IsDbGenerated="true"
IsVersion="true" AutoSync="Always"/>
</Type>
</Table>
But 'MyProject.DataTransfer.User' exists in the solution. What could be the possible reasons for this error?
Typo: MyProject.DataTrasnfer.User. You have transposed the s and the n.
I suppose that you have a class MyProject.DataTraSNfer.User in mapping and MyProject.DataTraNSfer.User in code. Misprint in post or in code?

Resources