How to bind an itemRenderer to a datagrid
I have a datagrid that uses an itemRenderer. The itemRenderer contains a checkbox. I want the selected checkbox in the datagrid to stay in the correct row when the datagrid is sorted, but when I sort a column the checkbox moves to the wrong row. How do I bind the checkBox to the datagrid? I tried playing around with the following 2 lines of code in the itemRenderer, but without success:
//super.data = value;
//dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
Thanks for looking.
Here is my main file:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var initDG:ArrayCollection = new ArrayCollection([
{Artist:'aaa', Album:'1', Price:3},
{Artist:'ccc', Album:'2', Price:2},
{Artist:'bbb', Album:'3', Price:1},
{Artist:'ddd', Album:'2', Price:4}
]]>
</mx:Script>
<mx:DataGrid id="myGrid" dataProvider="{initDG}" >
<mx:columns>
<mx:DataGridColumn dataField="Artist"/>
<mx:DataGridColumn dataField="Album"/>
<mx:DataGridColumn dataField="Price"/>
<mx:DataGridColumn itemRenderer="RendererDGImage"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Here is my itemRenderer:RendererDGImage.mxml
<?xml version="1.0"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var myVal:Boolean=false;
public function checkSelected():void {
myVal= ! myVal
override public function set data(value:Object):void {
//super.data = value;
if (myVal){
trace("true")
myCheckBox.selected=true;
} else {
trace("false")
myCheckBox.selected=false;
// Dispatch the dataChange event.
//dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
]]>
</mx:Script>
<mx:CheckBox id="myCheckBox" enabled="true" click="checkSelected();"/>
</mx:HBox>
I would create an object let's say.. Album.. that has four properties.. and create instances of this object based on the length of the arrayCollection..
and..
[Bindable]
public var album:Album;
public function checkSelected():void {
album.Buy = myCheckBox.selected.
change this too..
<mx:CheckBox id="myCheckBox" enabled="album.Buy" click="checkSelected();"/>
and finally..
override public function set data(value:Object):void {
album = (value as Album);
hope this helps,
BaBo,
Similar Messages
-
How To Update Custom ItemRenderer (Image) on DataGrid Edit
I have an DataGrid with 2 columns, column 1 called "Name" and column 2 called "Actions".
The "Name" column contains editable text and the "Actions" column uses a (inline) custom ItemRenderer which displays 2 icon images ( for Edit and Delete). All works fine. Clicking Edit or Delete calls the corrosponding outerDocument method.
The feature I am trying to add is as follows: when someone double-clicks on the text in the Name column to edit it, I would like the edit icon in the Actions column to ( grow/shrink, change color - or some such indication/reminder to click it ). Not seeing how to do this with the inline ItemRenderer, I created a custom item renderer class and, in that class, use mx:Resize to perform the "grow/shrink". I created a method called "pulse()" and, from within that renderer, all works well. ( for testing, I wired the icons click event to the pulse() method ). However, now I am not sure how to call that ItemRenderers "pulse()" method to perform the effect from the main DataGrid (when the user double-clicks on Name field to edit).
The tried using the DataGrid's "itemEditBegin", which fires correctly, but from that point I am not sure how to access the selected rows edit icon in the "Action" column. ( to call its pulse() ) method.
So any suggestions how I can achieve my end result? Being able to manipulate the edit icon in the "Actions" column, when the user double-clicks (edits) that row's "Name" column?
If I'm going about it all wrong, feel free to offer alternative solutions.
Any help would be appreciated.
Thanks,
~eHi,
Check the BAPI_MATERIAL_SAVEDATA ,in the BAPI is there a table parameter EXTENSIONIN ?
which you can use to pass the values for user defined fields to the BAPI..
Regards
Kiran Sure -
How to bind XML to Datagrid?
My xml is here:
<?xml version="1.0"?><ITRequests><CallInfo><id type="INT UNSIGNED">42</id><request_no type="VARCHAR">1313_IT_220520100709</request_no><requester_uid type="VARCHAR">administrator</requester_uid><request_date type="VARCHAR">22-May-2010 07:09:34 PM</request_date><title type="VARCHAR">Printer Installation</title><status type="VARCHAR">Closed</status></CallInfo><CallInfo><id type="INT UNSIGNED">43</id><request_no type="VARCHAR">1314_IT_220520100718</request_no><requester_uid type="VARCHAR">administrator</requester_uid><request_date type="VARCHAR">22-May-2010 07:17:49 PM</request_date><title type="VARCHAR">Software Installation</title><status type="VARCHAR">In Progress</status></CallInfo><CallInfo></ITRequests>
I don't know how to bind this to a simple datagrid.
Can someone help me please?
PS: The data is in a String variable.
Thanks,
NithGetting your data in the form a string is a PITA. Can you just use the XML itself, and convert it to an ArrayCollection? Then you could just use an HTTP request, for instance, to retrieve it.
Anyway, here is the code you need. It also demonstrates using E4X syntax to filter out the root node.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"creationComplete="initApp()"
>
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.collections.ArrayCollection;
private var strData:String = "<?xml version='1.0'?><ITRequests><CallInfo><id type='INT UNSIGNED'>42</id><request_no type='VARCHAR'>1313_IT_220520100709</request_no><requester_uid type='VARCHAR'>administrator</requester_uid><request_date type='VARCHAR'>22-May-2010 07:09:34 PM</request_date><title type='VARCHAR'>Printer Installation</title><status type='VARCHAR'>Closed</status></CallInfo><CallInfo><id type='INT UNSIGNED'>43</id><request_no type='VARCHAR'>1314_IT_220520100718</request_no><requester_uid type='VARCHAR'>administrator</requester_uid><request_date type='VARCHAR'>22-May-2010 07:17:49 PM</request_date><title type='VARCHAR'>Software Installation</title><status type='VARCHAR'>In Progress</status></CallInfo></ITRequests>";[
Bindable]
private var acData:ArrayCollection;
private function initApp():void{ getCallInfo();
private function getCallInfo():void{
//Convert string to XML:
var sxml:XML = new XML(strData);
//Create an ArrayCollection.
//Just get the 'CallInfo' nodes (ignoring the root node, 'ITRequests'):
acData =
new ArrayCollection(new XMLListCollection(new XMLList(sxml..CallInfo)).toArray());
trace(acData);}
]]>
</mx:Script>
<mx:DataGrid
dataProvider="{acData}">
<mx:columns>
<mx:DataGridColumn dataField="id" width="50"/>
<mx:DataGridColumn dataField="request_no" width="180"/>
</mx:columns></mx:DataGrid>
</mx:Application> -
How to bind several data (more then 7300) to datagrid
Hello,
I am trying to bind to datagrid several data. I created an observablecollection, i stocked data into this collection and then i binded this collection to my datagrid. In xaml file i declared my datacontext. When i did it my visual studio and all application
on my computer clock. I can't do anything. A simple think that i can do, is to close session and restart .
I need help.
Here is some sample:
code cs ViewModel:
using System;
using System.Collections.Generic;
using System.Text;
using GestionDeContrats_Offres_ClientsGUI.VueModele;
using System.Collections.ObjectModel;
using System.Windows.Data;
using System.ComponentModel;
using GestionDeContrats_Offres_Clients.GestionOffres;
using GestionDeContrats_Offres_Clients.GestionContrats;
using System.Windows.Input;
using GestionDeContrats_Offres_Clients.GestionModele;
using GestionDeContrats_Offres_ClientsGUI.crm;
using System.Data;
namespace GestionDeContrats_Offres_ClientsGUI.VueModele
/// <summary>
/// </summary>
public class GestionDeContratVueModele : VueModeleBase
private readonly ObservableCollection<ContratVueModele> contrats;
private readonly PagingCollectionView pagingView;
private GestionDeContrat gestiondecontrat;
/// <summary>
/// Constructeur de la classe
/// GestionDeContratVueModele
/// </summary>
public GestionDeContratVueModele() {
try
this.gestiondecontrat = new GestionDeContrat();
this.contrats = new ObservableCollection<ContratVueModele>();
this.contrats.Clear();
foreach (contract contrat in this.gestiondecontrat.ListeDeContrat())
// this.contrats.Add(new ContratVueModele());
this.contrats.Add(new ContratVueModele() { NOMDUCONTRAT = contrat.title, DATEDEDEBUT = contrat.activeon.Value, DATEDEFIN
= contrat.expireson.Value, LESTATUT = contrat.statecode.formattedvalue,LESTATUTAVANT=contrat.access_etatavant.name });
this.pagingView = new PagingCollectionView(this.contrats, 3);
if (this.pagingView == null)
throw new NullReferenceException("pagingView");
this.currentpage = this.pagingView.CurrentPage;
this.pagingView.CurrentChanged += new EventHandler(pagingView_CurrentChanged);
catch(System.Web.Services.Protocols.SoapException soapEx){
soapEx.Detail.OuterXml.ToString();
/// <summary>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void pagingView_CurrentChanged(object sender, EventArgs e)
OnPropertyChanged("SelectedContrat");
Dispose();
//throw new NotImplementedException();
/// <summary>
/// Propriété permettant de manipuler la
///Vue Modèle de la liste des contrats
/// </summary>
public ObservableCollection<ContratVueModele> Lescontrats
get
return this.contrats;
code xaml:
<UserControl x:Class="GestionDeContrats_Offres_ClientsGUI.VueModele.UserControlGestionContrat"
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"
x:Name="GestionContrat"
xmlns:local="clr-namespace:GestionDeContrats_Offres_ClientsGUI.VueModele"
d:DesignHeight="300" >
<UserControl.DataContext>
<local:GestionDeContratVueModele />
</UserControl.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="40"/>
<RowDefinition />
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="320"/>
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBox Name="searchtexbox" Grid.Column="0"/>
<Image Grid.Column="1" Source="/GestionDeContrats_Offres_ClientsGUI;component/Images/16_find.gif" />
</Grid>
<ToolBar Grid.Row="1" Name="toolbarcontrat">
<Button Name="btNewContrat" Click="btNewContrat_Click">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="/GestionDeContrats_Offres_ClientsGUI;component/Images/plusvert.jpg" />
<Label Content="Nouveau" Grid.Column="1"/>
</Grid>
</Button>
<Button Name="btCopierContrat" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="/GestionDeContrats_Offres_ClientsGUI;component/Images/editcopy.png" />
<Label Content="Copier" Grid.Column="1"/>
</Grid>
</Button>
<Button Name="btSupprimerContrat" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="/GestionDeContrats_Offres_ClientsGUI;component/Images/delgreen16.jpg" />
<Label Content="Supprimer" Grid.Column="1"/>
</Grid>
</Button>
<Button Name="btModifierContrat" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="/GestionDeContrats_Offres_ClientsGUI;component/Images/ico_18_4207.gif" />
<Label Content="Modifier" Grid.Column="1"/>
</Grid>
</Button>
</ToolBar>
<DataGrid Name="listViewContrat" Grid.Row="2" ItemsSource="{Binding Path=Lescontrats, Mode=OneWay}" IsSynchronizedWithCurrentItem="True" AutoGenerateColumns="False"
CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True" CanUserAddRows="True" CanUserDeleteRows="True">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Nom du contrat" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=NOMDUCONTRAT, Mode=OneWay}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Date de début" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DATEDEDEBUT, Mode=OneWay}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Date de fin" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DATEDEFIN, Mode=OneWay}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Statut" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=LESTATUT,Mode=OneWay}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Statut avant" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text=""/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Row="3" Orientation="Horizontal">
<Label Margin="2" Content=""/>
<Button Content="Suivant" Name="btNext" Margin="2" />
<Button Content="Précédent" Name="btPrevious" Margin="2" />
</StackPanel>
</Grid>
</UserControl>
I include link to this usercontrol into MainWindow.xaml.
Thanks
RegardsI think what darnold was trying to say....
Those very clever people who come up with insights on human behaviour have studied how many records a user can work with effectively.
It turns out that they can't see thousands of records at once.
Their advice is that one presents a maximum of 200-300 records at a time.
What with maybe 40 fitting on a screen at a time. Few people like spending 20 minutes scrolling through a stack of data they're not interested in to find the one record they're after.
Personally, I would use a treeview, set of combos or some such so the user can select what subset they are interested in and present just that.
Anyhow.
If you have a viewmodel which exposes an observable collection<t> as a public property you can bind the itemssource of a datagrid to that.
Although UI controls have thread affinity, the objects in such a collection do not.
That means you can use another thread to go get your data, add it to the observable collection, the fact it's an observable collection tells the view as records are added and it will show them. The ui will remain responsive.
You can do this using skip and take to read a couple hundred records at a time and add those, pause and repeat for the next couple hundred records. Use linq - skip and take.
Please don't forget to upvote posts which you like and mark those which answer your question.
My latest Technet article - Dynamic XAML -
How to bind each DataGrid column separately?
Good day fellow Flex developers!
Could you please help me out. I am trying to figure out how to bind each DataGrid column separately. I need to bind each column to a separate bindable array variable. Is there a dataProvider property for each DataGridColumn???
Thanks in advance,
Eugenehopefully nope
just imagine code complexity for that feature?
how would you think should behave DataGrid when you'll populate your separate arrays with variable items number each?
all you are able and should do is to build composite dataProvider source, join all your separate arrays into it, this is your responsibility.
If you feel this message answers your question or helps, please mark it respectively -
How to bind list data to XML Web service request
How do I bind specific columns in a DataGrid to the Web
service request? I'm having trouble finding any documentation that
addresses that specific pattern, i.e. sending a complex list to the
server via a Flex Web service send() command. I'm fairly new to
Flex programming and don't know if what I want to do is possible.
Here what I've been able to do so far.
1. Using a Web service called a service on the server and
retrieved a complex list.
2. Poplulated a DataGrid with the result
3. The user has selected multiple rows from the DataGrid
using a checkbox column
4. The user pressed a button that calls a Web service send().
This Web service should only send data from only two columns and
only for those rows the user has checked.
5. I can loop over the DataGrid and find the selected rows
and put them in another ArrayCollection called 'selectedRows'.
The issue is that I don't know how to bind 'selectedRows' to
the Web service. Right now I'm reading up on "Working with XML" in
the Programming with ActionScript 3.0 chapter. But I'm just fishing
here. No bites yet.Don't bind. Build the request object programatically, as you
are doing with your selectedRows AC, and send(myObject) that.
Tracy -
Change ItemRendere Properties in DATAGRID
Hi,
I created a DATAGRID with some Itemrenderers in it.
I am trying to change the properties of itemrendere on
rollOver of DATAGRID.
code:
Code:
<mx:DataGrid id="dataGrid" dataProvider="{targetProfiles}"
itemRollOver="onItemRollOver(event)"
itemRollOut="hideMenu(event)">
<mx:columns>
<mx:DataGridColumn id="nameCol" dataField="Name"
headerText="Name"
itemRenderer="components.itemrenderer.labelName">
</mx:DataGridColumn>
<mx:DataGridColumn id="description"
dataField="Description"
headerText="Description" />
</mx:DataGrid>
code for ITem Renderer
Code:
<?xml version="1.0"?>
<!-- dpcontrols/adg/myComponents/ChartRenderer.mxml -->
<mx:VBox height="65" width="100%" xmlns:mx="
http://www.adobe.com/2006/mxml"
verticalAlign="middle">
<mx:HBox paddingLeft="20" paddingTop="5"
verticalAlign="bottom">
<mx:Label text="{data.Name}"/>
</mx:HBox>
<mx:HBox horizontalAlign="right"
verticalAlign="bottom">
<mx:Button id="options" text="Options"
visible="false"/>
</mx:HBox>
</mx:VBox>
Now what am trying to do is.. On rollOver and rollOut of
particular row in datagrid i want to make that Button in Itemrender
visible true/false(on selected row).
Any idea how to identify the itemRenderer on rollOver of
grid????
Thanks & Regards
PratapHi,
Try handling rollOver event of the item renderer instead of listening on the DataGrid.
Hope this helps. -
I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
1. Party (PartyId, Name)
2. Case (CaseId, CaseNo)
3. Petitioner (CaseId, PartyId) ............. Link Table
I am completely new to .Net and to begin with I download Microsoft's sample application and
following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
users can choose one from the dropdown list to add or edit the petitioner.Hello Barry,
Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
the sample available at the link you supplied.
To get the idea of the thing here is my code behind of a view vBoxPetitioner:
<UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
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"
xmlns:v="clr-namespace:CCIS.View.Case"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
d:DesignWidth="300"
d:DesignHeight="200">
<UserControl.Resources>
<DataTemplate DataType="{x:Type vm:vmPetitioner}">
<v:vPetitioner Margin="0,2,0,0" />
</DataTemplate>
</UserControl.Resources>
<Grid>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Margin="2">
<Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
| <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
</TextBlock>
</StackPanel>
</HeaderedContentControl.Header>
<ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
</HeaderedContentControl>
</Grid>
</UserControl>
This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
Here is the code of vmPetitioner, a ViewModel:
Imports Microsoft.VisualBasic
Imports System.Collections.ObjectModel
Imports System
Imports CCIS.Model.Party
Namespace CCIS.ViewModel.Case
''' <summary>
''' ViewModel of an individual Email
''' </summary>
Public Class vmPetitioner
Inherits vmParty
''' <summary>
''' The Email object backing this ViewModel
''' </summary>
Private petitioner As tblParty
''' <summary>
''' Initializes a new instance of the EmailViewModel class.
''' </summary>
''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
Public Sub New(ByVal detail As tblParty)
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Me.petitioner = detail
End Sub
''' <summary>
''' Gets the underlying Email this ViewModel is based on
''' </summary>
Public Overrides ReadOnly Property Model() As tblParty
Get
Return Me.petitioner
End Get
End Property
''' <summary>
''' Gets or sets the actual email address
''' </summary>
Public Property fldPartyId() As String
Get
Return Me.petitioner.fldPartyId
End Get
Set(ByVal value As String)
Me.petitioner.fldPartyId = value
Me.OnPropertyChanged("fldPartyId")
End Set
End Property
End Class
End Namespace
And below is the ViewMode vmParty which vmPetitioner Inherits:
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports CCIS.Model.Case
Imports CCIS.Model.Party
Imports CCIS.ViewModel.Helpers
Namespace CCIS.ViewModel.Case
''' <summary>
''' Common functionality for ViewModels of an individual ContactDetail
''' </summary>
Public MustInherit Class vmParty
Inherits ViewModelBase
''' <summary>
''' Gets the underlying ContactDetail this ViewModel is based on
''' </summary>
Public MustOverride ReadOnly Property Model() As tblParty
'''' <summary>
'''' Gets the underlying ContactDetail this ViewModel is based on
'''' </summary>
'Public MustOverride ReadOnly Property Model() As tblAdvocate
''' <summary>
''' Gets or sets the name of this department
''' </summary>
Public Property fldName() As String
Get
Return Me.Model.fldName
End Get
Set(ByVal value As String)
Me.Model.fldName = value
Me.OnPropertyChanged("fldName")
End Set
End Property
''' <summary>
''' Constructs a view model to represent the supplied ContactDetail
''' </summary>
''' <param name="detail">The detail to build a ViewModel for</param>
''' <returns>The constructed ViewModel, null if one can't be built</returns>
Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Dim e As tblParty = TryCast(detail, tblParty)
If e IsNot Nothing Then
Return New vmPetitioner(e)
End If
Return Nothing
End Function
End Class
End Namespace
And final the code behind of the view vPetitioner:
<UserControl x:Class="CCIS.View.Case.vPetitioner"
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"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
Width="300">
<UserControl.Resources>
<ResourceDictionary Source=".\CompactFormStyles.xaml" />
</UserControl.Resources>
<Grid>
<Border Style="{StaticResource DetailBorder}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Petitioner:" />
<ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
</Grid>
</Border>
</Grid>
</UserControl>
The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
what I need to Know is how to route the binding path if it exists in a different ViewModel?
Sir, I look forward to your early reply bringing a workable solution to the problem I face.
Warm Regards,
Arun -
Hello,
on my page I have 2 items:checkbox and text area. How to bind its work processes together? For example, when checkbox is checked then Text area is disable and when not then enable.
Thanks' for help.
Karina.hi karina--
this, too, is javascript question. please see my answer to your previous post...
Multiselect list (LOV)
...regards,
raj -
How to bind a UI element to the context
Hi Experts,
I have a problem binding UI element to the context. In my code i have to create TabStrips dynamically and under this tabstrip number of UI elements would be there. For this i have a code like this..
IWDTransparentContainer theActionContainer =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDTabStrip ts = (IWDTabStrip) view.createElement(IWDTabStrip.class,"TabStrip");
IWDTab tab1 = (IWDTab) view.createElement(IWDTab.class,"Tab1");
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
IWDCaption header1 = (IWDCaption) view.createElement(IWDCaption.class,"Header1");
header1.setText("Tab1");
tab1.setContent(in);
ts.addTab(tab1);
IWDTab tab2 = (IWDTab) view.createElement(IWDTab.class,"Tab2");
IWDInputField in2 = (IWDInputField) view.createElement(IWDInputField.class,"in2");
IWDCaption header2 = (IWDCaption) view.createElement(IWDCaption.class,"Header2");
header2.setText("Tab2");
tab2.setHeader(header2);
ts.addTab(tab2);
theActionContainer.addChild(ts);
<b>when i run this code it is giving following exceptions..</b>
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
... 63 more
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripItemContentFragment(TabStripRenderer.java:1867)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripFragment(TabStripRenderer.java:838)
From these exceptions what i understood is, i need to bind these UI elements to context.
Can any body tell me how to bind a UI element to the context if I understood the exceptions correct..
Thanks in Advance,
Murthy.HI,
lets say Ctx is your context attribute,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getAttribute("Ctx");
then , as per your code,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
if your contex attribute is child of some other node then do like this,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getChildNode("SalesOrder",0)getAttribute("Ctx");
//this is when Ctx is child of node SalesOrder, and we are taking Ctx from its 0th element
then ,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
include this in your code ,
let me know if you face any problem
regards
reward points if it helps -
How to bind an aggregated list to a variable in an IN or ANY clause
Hello, and thank you for helping -
I have a process that involves a parameter assertion, the result of which is a string for an IN or ANY clause. I am not able to figure out how to bind the result of the assertion to to executable SQL. The actual business process is long and laborious and, I decided, not worth explaining for the purpose of this forum. I have abstracted the process into some dummy data. The goal is to bind v_any_condition to :a. I could certainly build the SQL without the binding, but I would be very interested to know just the same what I am missing here (I'm sure something simple, or just a basic SQL rules that I have missed).
Thanks!
DECLARE
-- The goal is to bind v_any_condition in an ANY clause
v_any_condition VARCHAR2(30) DEFAULT '4,9,d'; -- the three rows to return from the sample data
-- v_any_condition VARCHAR2(30) DEFAULT DBMS_ASSERT.ENQUOTE_LITERAL('4')||','||
-- DBMS_ASSERT.ENQUOTE_LITERAL('9')||','||
-- DBMS_ASSERT.ENQUOTE_LITERAL('d');
v_sql varchar2(2048);
-- We'll create a simple cursor of VARCHAR2(1) just like DUAL.DUMMY
rc sys_refcursor;
rc_record dual%ROWTYPE;
v_counter NUMBER DEFAULT 0;
BEGIN -- Build the SQL. In this example, we decompose an aggregated string
-- containing the first 16 hex numbers. The result is a simple 16-row table
-- from which we will attempt to return the three rows by binding
-- v_any_condition to ANY in the SQL below.
v_sql := '
SELECT token
FROM ( -- materialize the list
WITH t AS (SELECT ''0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f'' AS txt FROM DUAL)
-- then decompose the list into rows
SELECT REGEXP_SUBSTR (txt, ''[^,]+'', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,''[^,]*''))+1
/* WHERE token = ANY(''4'',''9'',''d'') */ -- hardcoding works
WHERE token = ANY(:a) -- binding does not work; the goal is to get this to work '
OPEN rc FOR v_sql USING v_any_condition; -- when binding, we never even enter the loop
LOOP
v_counter := v_counter + 1;
FETCH rc INTO rc_record;
EXIT WHEN rc%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (v_counter || ': '||rc_record.dummy);
END LOOP;
END;
Edited by: ltps on Jan 9, 2012 4:28 PMSuperb. Thank you very much.
For anyone who is interested in the solution I chose, here is the revised SQL that accepts a list as a bind variable after casting the list as a table. The "split string" code is below that. (What look like double quotes in the block below are actually consecutive single quotes.)
DECLARE
v_any_condition VARCHAR2(30) DEFAULT '4,9,d';
v_sql varchar2(2048);
rc sys_refcursor;
rc_record dual%ROWTYPE;
v_counter NUMBER DEFAULT 0;
BEGIN
v_sql := '
SELECT token
FROM (
WITH t AS (SELECT ''0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f'' AS txt FROM DUAL)
-- then decompose the list into rows
SELECT REGEXP_SUBSTR (txt, ''[^,]+'', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,''[^,]*''))+1
, TABLE(CAST(XX_SPLIT_STRING(:a,'','') AS XX_SPLIT_TABLE)) cst
WHERE cst.column_value = token'
OPEN rc FOR v_sql USING v_any_condition;
LOOP
v_counter := v_counter + 1;
FETCH rc INTO rc_record;
EXIT WHEN rc%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (v_counter || ': '||rc_record.dummy);
END LOOP;
END;
-- And the main SQL, just for clarity:
SELECT token
FROM (
WITH t AS (SELECT '0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f' AS txt FROM DUAL)
SELECT REGEXP_SUBSTR (txt, '[^,]+', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,'[^,]*'))+1
, TABLE(CAST(XX_SPLIT_STRING('4,9,d',',') AS XX_SPLIT_TABLE)) cst
WHERE cst.column_value = token;
CREATE OR REPLACE FUNCTION XX_SPLIT_STRING (
p_string VARCHAR2
, p_delimiter VARCHAR2 DEFAULT ','
RETURN XX_SPLIT_TABLE PIPELINED
IS
l_idx PLS_INTEGER;
l_string VARCHAR2(32767) := p_string;
l_value VARCHAR2(32767);
BEGIN
LOOP
l_idx := INSTR ( l_string, p_delimiter );
IF l_idx > 0 THEN
pipe ROW ( SUBSTR ( l_string, 1, l_idx - 1 ) );
l_string := SUBSTR ( l_string, l_idx + LENGTH (p_delimiter) );
ELSE
PIPE ROW ( l_string);
EXIT;
END IF;
END LOOP;
RETURN;
END XX_SPLIT_STRING; -
How to bind JtextFields in Swing to Table fields in the database
Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
Am really new to java programming and have interest in learningThe standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started. -
How to bind "Image Field" object on a database
Hi to all
I inserted into a dynamic PDF (Livecycle ES3 trial) an image field, but I don't understand how I can to bind a JPG into a database.
In (F5) preview... I'm able to open a image file on filesystem and visualize it on PDF form... but then? How to bind on database?
In my several tentatives I'm using a MS Access 2010 database table, where I defined a OLE object... but doesn't work.
Thank you at all.
visertHi,
I have not tried to do this, but this document provides some instructions.
http://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdfhttp://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdf
Hope it helps
Bruce -
How to bind a JTable in runtime.
Hello Guys,
Anyone know tell me how to bind a JTable adf Swing at Runtime?
In other words, I want to create the bindings when the application to be running.
Thanks in advanced.Try the static createAttributeListBinding() methods in JUTableBinding.
Sascha -
How to bind korean parameters in XSQL????
Hi,
I am binding english parameters in XSQL very well.
But when I am trying to bind japaneese or korean it is not displaying rows.
I am giving the sample code.
hello.xsql
<?xml version="1.0" encoding="euc-kr"?>
<xsql:query connection="scs" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:xsql="urn:oracle-xsql" row-element="ADDRESSES_ROW">
select * from emp where name='{@name}'
</xsql:query>
Request: http://hello.xsql?name=JOHN ::: working fine
Request: http://hello.xsql?name=koreanName :::Not working
Please help me in this regard.
How to bind name in korean in XSQL servlet..
Regards,
sudhiDo you have nlscharset_12.jar in your classpath?
what web server are you using XSQL with?
Have you tried using real bind variables like this:
<xsql:query bind-params="name">
select * from emp where ename = ?
</xsql:query>
Does a query like:
<xsql:query bind-params="name">
select * from emp
</xsql:query>
return the korean data to the browser correctly?
Maybe you are looking for
-
hi guys, I want to make a financial report using hierarchy from R/3. but there are some missing node from R/3 and I want to add it in BW Exp : Hierarchy at my R/3 is like this : revenue cogs operating expenses etc... where I want to have report like
-
Page up & page down keys don't work in Preview
why don't the Page Up and Page Down keys on an extended (Apple) keyboard work in Preview? very annoying. only the up-down arrows seem to work, and only one line at a time. i'd like to jump whole pages, or something close to that. if anyone knows a ke
-
Cannot connect p7-1074 to Sony Smart TV
I have the above pc connected to tv with high speed hdmi cable from DVI port to HDMI port on tv. It's not connecting at all. Please help.
-
Calling Mac form Ipad2 works fine. I call from Ipad2 to Mac it is alway not available. Both Mac and Ipad2 has OS 5 and the latest Factime app. Please help.
-
Can someone help me. I have made flash document. I tried to link a button with a landingpage. I did this in the symbol properties of this button. There I linked an URL there. In the swf it links not to the given up URL in the browser but it linked to