Combo box in datagrid
Hello,
I have combobox in my datagrid, the combo box is as follow:
<fx:Component id="inlineEditor">
<mx:ComboBox >
<mx:dataProvider>
<fx:String>MR. ONE</fx:String>
<fx:String>MR. TWO</fx:String>
<fx:String>MR. FOUR</fx:String>
<fx:String>MR. FIVE</fx:String>
</mx:dataProvider>
</mx:ComboBox>
</fx:Component>
And my datagrid is;
<mx:DataGrid id="dataGrid" editable="true" x="167" y="119" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getAllResult.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="id" dataField="id" editable="false"/>
<mx:DataGridColumn headerText="name" dataField="name"/>
<mx:DataGridColumn headerText="surName" dataField="surName"
itemEditor="{inlineEditor}"
editorDataField="selectedItem" />
<mx:DataGridColumn headerText="unitId" dataField="unitId"/>
<mx:DataGridColumn headerText="datum" dataField="datum"
itemRenderer="mx.controls.DateField"
rendererIsEditor="true"
editorDataField="selectedDate"/>
<mx:DataGridColumn headerText="company" dataField="company"
itemRenderer="mx.controls.CheckBox"
rendererIsEditor="true"
editorDataField="selected"/>
</mx:columns>
</mx:DataGrid>
Now this works fine with the values from the combobox. The issue here is that I need the combo box to be populated from a table/model, normaly I would use outside of the datagrid:
<s:ComboBox x="138" y="399" id="comboBox" creationComplete="comboBox_creationCompleteHandler(event)" labelField="name">
<s:AsyncListView list="{getAllResult2.lastResult}"/>
</s:ComboBox>
And this would work fine. But how to use this combobox in the datagrid. I use LCSD for DMS.
All help is appriciated
I put the following code in that I took from samples:
Bindable]public var test:ArrayCollection;
private
function init():void
test =
new ArrayCollection([{label:"High", data:"high"},{label:
"Medium", data:"medium"},{label:
"Low", data:"low"}])
Then in the mxml:
<mx:DataGridColumn
headerText="From Fiscal Period">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox dataProvider="{test}">
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
I still get the same error: 1120: Access of undefined property test.
Similar Messages
-
Enable / disable combo box in datagrid cell
I have a datagrid with 8 columns 2 check boxes a text box and
5 combo boxes. I am trying to disable the combo boxes if the first
check box is not checked. So far I am able to disable the entire
column with the combo box in it, but what i am trying to achieve is
if the check box is false then the 5 combo boxes are to be
disabled.
So what I am asking in a nutshell is is there a way to enable
or disable particular cells in a datagrid ?
Example
of what I have already done
Any suggestions will be gratefully received.I put the following code in that I took from samples:
Bindable]public var test:ArrayCollection;
private
function init():void
test =
new ArrayCollection([{label:"High", data:"high"},{label:
"Medium", data:"medium"},{label:
"Low", data:"low"}])
Then in the mxml:
<mx:DataGridColumn
headerText="From Fiscal Period">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox dataProvider="{test}">
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
I still get the same error: 1120: Access of undefined property test. -
I have looked everywhere and I am having a hard time finding
a good example of how to use a combo box in a datagrid. I want to
use a dataprovider for my datagird but as soon as I get inside my
itemRenderer it throws an error saying Access of undefined property
model even though it is defined above. Can someone please help me.
I may be way off??
<mx:DataGrid x="10" y="10" width="840" height="120"
dataProvider="{model.acProducts}">
<mx:columns>
<mx:DataGridColumn dataField="UPC Number">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox
dataProvider="{model.acProducts}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="proddesc"
headerText="Product Name" />
<mx:DataGridColumn headerText="Lot Number" />
<mx:DataGridColumn headerText="Product Category" />
<mx:DataGridColumn headerText="EPA" />
<mx:DataGridColumn headerText="AE Count">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center">
<mx:Script>
<![CDATA[
[Bindable]
public var selected:Boolean;
]]>
</mx:Script>
<mx:CheckBox id="displayCheckBox" click="selected =
displayCheckBox.selected"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>i got it. Heres the code for everyone who is wondering
<mx:DataGrid x="10" y="10" width="840" height="120"
dataProvider="{model.acProducts}" ro>
<mx:columns>
<mx:DataGridColumn dataField="UPC Number">
<mx:itemRenderer>
<mx:Component>
<mx:HBox>
<mx:Script>
<![CDATA[
import
com.serg.reportingTool.model.SergReportingToolModelLocator;
[Bindable] private var model:SergReportingToolModelLocator =
SergReportingToolModelLocator.getInstance();
]]>
</mx:Script>
<mx:ComboBox
id="occurenceCode"
labelField="OccurrenceCode"
dataProvider="{model.acOccurrences}"
/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="proddesc"
headerText="Product Name" />
<mx:DataGridColumn headerText="Lot Number" />
<mx:DataGridColumn headerText="Product Category" />
<mx:DataGridColumn headerText="EPA" />
<mx:DataGridColumn headerText="AE Count">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center">
<mx:Script>
<![CDATA[
[Bindable]
public var selected:Boolean;
]]>
</mx:Script>
<mx:CheckBox id="displayCheckBox" click="selected =
displayCheckBox.selected"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid> -
Problem rendering a combo box in the data grid
Hi,
I am rendering a combo box in the data grid control using an
item renderer. When I click on it to select a value from the drop
down, the combo box immediately closes giving no time to even click
on the dropdown. This doesn’t happen every time the combo is
clicked, although it happens frequently. What I think is that the
problem arises because the data grid tries to refresh the renderers
and during this process, the existing combo is removed, thereby
getting closed automatically. Please let me know of a work around.
Thanks,
Chereehi hiwa,
i have to add combo box in datagrid dynamically.
it should append as and when i add the data in the above text boxes.
thanks in advance. -
How to view the records in datagrid using Combo Box Selection
hi friends,
i having one combo box,that combo box having 10 students name in list format.
If i click any one of the students name it will only show the Particular student record in datagrid with respective fields(student name,rollnumber,percentage);
how i will do this
please give any suggession or show snippet demo.
it will be more helpful to do this,
Thanks in advance
B.Venktesan.Hi,
As your requirement , i think you will have to use selectedItem or selectedIndex property of combobox. And accordingly fetch data and provide it to dataprovider of datagrid.Following code can help you.
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
library://ns.adobe.com/flex/spark" xmlns:mx="
library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import spark.components.List;[
Bindable]
var array:ArrayCollection = new ArrayCollection();
public function insert():void{
array.addItem(Combo1.selectedItem
as String);DG1.dataProvider=array;
]]>
</fx:Script>
<s:ComboBox x="118" y="64" id="Combo1" change="insert()" >
<s:dataProvider>
<s:ArrayList>
<fx:String>AAA</fx:String>
<fx:String>BBB</fx:String>
<fx:String>CCC</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:ComboBox>
<mx:DataGrid x="118" y="154" id="DG1" >
<mx:columns>
<mx:DataGridColumn>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid></s:Application>
Thanks and Regards,
Vibhuti Gosavi | [email protected] | www.infocepts.com -
How to display data in a grid after selecting topic from combo box?
could someone help me out? i'm displaying a combo box (about
20 items) vertically. when user selects one of these items, i'd
like for information regarding that choice to be displayed in my
data grid. thanks - Karl from KansasIf you have the following:
<mx:ComboBox id="combo_box" dataProvider="{users}"
labelField="user_name" change="show_details(event)"
></mx:ComboBox>
<mx:DataGrid id="data_grid" >
<mx:columns>
<mx:DataGridColumn headerText="Name"
dataField="user_name"/>
<mx:DataGridColumn headerText="email"
dataField="email"/>
</mx:columns>
</mx:DataGrid>
private function show_details(evt:Event):void {
data_grid.dataProvider = evt.currentTarget.selectedItem
This assumes that your combo box data has a user_name and
email property value. Substitute your property values where needed.
Vygo -
Selecting item in combo box itemEditor, after passing it's dataprovider from a popup window
Hi..
I have a datagrid which has a combo box itemeditor in the first column. When I click on the combobox, there is an item called 'Search'. When this is selected, a pop up window appears where we can search for some contact names. The search results are populated in List component, within the pop up and on double click of any of the names from the list, all of the list content is passed on as dataprovider to the combobox itemeditor of the grid. It works fine till here. Now, how can I highlight the selected name(name on which I double click, in the list of the pop up window), as the 'selectedItem' of the combobox itemeditor? ie., as soon as I double click the name, that name should appear on that combo box. As of now, wehn I double click, the search result names are passed on as dataprovider to the combobox, but a blank entry will be selected in th combobox, instead of the selected name from teh list of the pop up window. Can you please help me out on how to achieve this? I had been cracking my head for 2days now, hasn't worked out yet for meHi...
there are two events which have been used, one is doubleclick event and the other one is on selecting the item from the list and clicking on OK button(this will be the most frequently used function, i cannot use event target event for this OK button... ) . I have attached the screen shot. Please have a look at it and let me know how can i achieve that...
I can use custom event, but the main problem is that the inline itemeditor's details are not accessible in the code.... I can access some function from within the inline itemeditor combo box using outerDocument.myFunction() (this is something like GET). Is there a similar way, to SET the data into this itemeditor? -
Flex 2.0 - Combo box /TextField Population
Hi,
This is my first post on this forum. I have downloaded a
trial version of Flex 2.0, and I am creating a small application. I
have a combo box that has a few items( around 6 options), when
these items are selected a text box should update with text read in
from a txt file. I am able to get the combo working, but I don't
know how to read the text in from the txt file, so each option will
load in it's related text content from a txf file. How do I trigger
this from the combo ?
I have looked in at the help, but they say you have to
preload and use URL Loader...is this true ?...How to go about it ?
Please help, you can contact me at [email protected]create a new project create a data folder and within a
data.xml paste this in the file:
<?xml version="1.0" encoding="UTF-8"?>
<RECORDS>
<RECORD>
<ID>1</ID>
<city>Suite 127 17008-90 Avenue</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T5T1L6anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%224313020%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A24%3A%22Biard+Financial+Servic es%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A26%3A%22Suite+127%2C+17008-90+Avenue</maplink>
<phone>(780) 907-9267</phone>
<prov>AB</prov>
<pcode>T5T1L6</pcode>
<uuid>A1A99A00-CEC7-C631-7940416FFBB9B6EE</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>2</ID>
<name>Bielertgary</name>
<city>Barr</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T0G0E0anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2263368%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A11%3A%22Bielertgary%22%3Bs%3A11% 3A%22AddressFl%22%3Bs%3A11%3A%225024+49a+St%22%3Bs%3A11%3A%22AddressCity%22</maplink>
<phone>(780) 674-2505</phone>
<prov>AB</prov>
<address>5024 49a St</address>
<pcode>T0G0E0</pcode>
<uuid>A1A99A10-C7A6-2C3F-17FE147F162E4AC3</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>3</ID>
<name>Bienvenu Michel Compt Agree</name>
<city>Cowansville</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=J2K1A1anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%224135469%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A27%3A%22Bienvenu+Michel+Compt+ Agree%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A20%3A%224150+Ste+Catherine+W%22%3</maplink>
<phone>(450) 931-0841</phone>
<prov>QC</prov>
<address>4150 Ste Catherine W</address>
<pcode>J2K1A1</pcode>
<uuid>A1A99A20-0163-5D90-7585D3C454987F6A</uuid>
<email>""</email>
<zoneID>Granby</zoneID>
</RECORD>
<RECORD>
<ID>4</ID>
<name>Big Red Income Tax and Accounting</name>
<fax>(780) 471-6221</fax>
<city>Edmonton</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T5G1K7anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2250452%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A31%3A%22Big+Red+Income+Tax+%26+A ccounting%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A14%3A%2211107+95+St+Nw%22%3Bs</maplink>
<phone>(780) 471-6251</phone>
<prov>AB</prov>
<address>11107 95 St Nw</address>
<pcode>T5G1K7</pcode>
<uuid>A1A99A2F-9E3F-7F4A-A47771D9B6638979</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>5</ID>
<name>Biggar Accounting Services</name>
<city>Biggar</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=S0K0M0anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2219880%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A26%3A%22Biggar+Accounting+Servic es%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A11%3A%22207+Main+St%22%3Bs%3A11%3A%2</maplink>
<phone>(306) 948-5133</phone>
<prov>SK</prov>
<address>207 Main St</address>
<pcode>S0K0M0</pcode>
<uuid>A1A99A3F-BCAF-7437-53DCE3CD8EAC334B</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>6</ID>
<name>Biggs Gary L Chartered Accountant</name>
<city>Edmonton</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T6J6L1anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2242764%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A33%3A%22Biggs+Gary+L+Chartered+A ccountant%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A25%3A%2210407+40+Avenue+North</maplink>
<phone>(780) 448-9221</phone>
<prov>AB</prov>
<address>10407 40 Avenue Northwest</address>
<pcode>T6J6L1</pcode>
<uuid>A1A99A4F-E8ED-C59F-58C5FC40A613E699</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>7</ID>
<name>Bigras Roger C A</name>
<fax>(450) 625-0641</fax>
<city>Laval</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=H7P4A3anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%223947434%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A16%3A%22Bigras+Roger+C+A%22%3B s%3A11%3A%22AddressFl%22%3Bs%3A26%3A%223180+Bd+Dagenais+O+Fabrvle%22%3Bs%3A</maplink>
<phone>(450) 622-6430</phone>
<prov>ON</prov>
<address>3180 Bd Dagenais O Fabrvle</address>
<uuid>A1A99A5E-DF97-BF84-6863D3385A2A5B86</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
</RECORDS>
then in the main application file paste this
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="xmldata.send();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
[Bindable]
public var mxdata:Object;
public function httpHandler(event:ResultEvent):void{
//the property lastresult dumps the object in the
application then the xpath allows you to get the propertysa you
want...
mxdata = xmldata.lastResult.RECORDS.RECORD;
private function server_fault(event:FaultEvent):void
Alert.show( ObjectUtil.toString(event.fault) );
]]>
</mx:Script>
<mx:HTTPService url="data/data.xml" id="xmldata"
result="httpHandler(event)" fault="server_fault(event)"/>
<mx:DataGrid dataProvider="{mxdata}"/>
<mx:ComboBox dataProvider="{mxdata}" labelField="name"
id="selectedData" x="10" y="179"/>
<mx:Form x="10" y="240">
<mx:TextInput id="ID"
text="{selectedData.selectedItem.ID}"/>
<mx:TextInput id="nameui"
text="{selectedData.selectedItem.name}"/>
<mx:TextInput id="fax"
text="{selectedData.selectedItem.fax}"/>
<mx:TextInput id="city"
text="{selectedData.selectedItem.city}"/>
<mx:TextInput id="maplink"
text="{selectedData.selectedItem.maplink}"/>
<mx:TextInput id="phone"
text="{selectedData.selectedItem.phone}"/>
<mx:TextInput id="prov"
text="{selectedData.selectedItem.prov}"/>
<mx:TextInput id="address"
text="{selectedData.selectedItem.address}"/>
<mx:TextInput id="pcode"
text="{selectedData.selectedItem.pcode}"/>
<mx:TextInput id="uuid"
text="{selectedData.selectedItem.uuid}"/>
<mx:TextInput id="email"
text="{selectedData.selectedItem.email}"/>
<mx:TextInput id="zoneID"
text="{selectedData.selectedItem.zoneID}"/>
</mx:Form>
</mx:Application>
i hope this helps : ) -
Need Help. Data jumps between Combo Boxes in an ADG
I have an item renderer in an advanced datagrid.
<mx:AdvancedDataGridColumn
dataField="USE_TYPE_DESC"
headerText="Use Type"
rendererIsEditor="true"
itemRenderer="renderers.tpUseTypeDropDown"
editorDataField="getData"/>
But the data that gets displayed in the combo boxes, appear to jump between CBs when you scroll the ADG up and down. The physical data is fine, its just the displayed data that is wrong.. Any ideasOk, I tried this but still getting an error
<cfquery datasource="mydb" name="test">
Select name from mytable
where
<cfqueryparam value=#createodbcdate(edate)# cfsqltype="CF_SQL_DATE"> Between '01/01/2011' AND '01/01/2013'
</cfquery>
<cfoutput query="test">
#ename#
</cfoutput>
now I get
An error occurred while evaluating the expression:
"#createodbcdate(edate)#"
Error near line 3, column 53.
Error resolving parameter EDATE -
how can i add a combo box in to the Data grid when i click the add button.
when i add the second row what i have selected before is refreshed.
please help meThe data property of the item renderer corresponds to the
item the item renderer renders (a lot of repetitions here... :-).
But when your application starts, the data property of your
item renderer is null. Still, the code is executed. So you get a
null pointer exception.
How to solve this problem ?
Use databinding within the item renderer in order to detect
the data value change from null to an object value:
<mx:Binding source="{this.data}"
destination="onDataChanged" />
private function set onDataChanged(value:Object):void
if(value)
// Do something if value is non-null
Voila !
No more errors.
Since the item has a type in the dataprovider of my datagrids
in my projects, I cast the data property to an explicit type before
accessing the item properties:
E.g
(this.data as Product).ISBN -
How to populate data in the data table on combo box change event
hi
i am deepak .
i am very new to JSF.
my problem is i want to populate data in the datatable on the combo box change event.
for example ---
combo box has name of the city. when i will select a city
the details of the city should populate in the datatable. and if i will select another city then the datatable should change accordingly..
its urgent
reply as soon as possible
thanks in advancei am using Rational Application Developer to develop my application.
i am using a combo box and i am assigning cityName from the SDO.
and i am declaring a variable in the pageCode eg.
private String cityName;
public void setCityName(String cityName){
this.cityName = cityName;
public String getCityName(){
return cityName;
<h:selectOneMenu id="menu1" styleClass="selectOneMenu" value="#{pc_Test1.loginID}" valueChangeListener="#{pc_Test1.handleMenu1ValueChange}">
<f:selectItems
value="#{selectitems.pc_Test1.usercombo.LOGINID.LOGINID.toArray}" />
</h:selectOneMenu>
<hx:behavior event="onchange" target="menu1" behaviorAction="get"
targetAction="box1"></hx:behavior>
and also i am declaring a requestParam type variable named city;
and at the onChangeEvent i am writing the code
public void handleMenu1ValueChange(ValueChangeEvent valueChangedEvent) {
FacesContext context = FacesContext.getCurrentInstance();
Map requestScope = ext.getApplication().createValueBinding("#{requestScope}").getValue(context);
requestScope.put("login",(String)valueChangedEvent.getNewValue());
and also i am creating another SDO which is used to populate data in datatable and in this SDO in the where clause i am using that requestParam .
it is assigning value in the pageCode variable and in the requestParam but it is not populating the dataTable. i don't no why??
it is possible that i may not clear at this point.
please send me the way how my problem can be solved.
thanks in advance -
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 -
Not able to populate data in the combo box
Hi Guys,
I m new to flex development and I want to populate the data
coming from the databasein the combobox.I am able to get the length
.but not able to populate the data.
Can anyone helpme out?
The code is below:
The data displayed in the combox box is displayed as
[object],[object] etc.I m sure that the data is coming from the
database and its not populated in the combo box.any help is
appreciated.
private function getParkinfo(event:ResultEvent):void
{ Alert.show(event.result.length.toString());
countries.dataProvider = event.result;
<mx:ComboBox id="countries" />What does the data look like in the result? Is it XML? Post a
sample of it. -
Display data in list and combo box
hi all....
how to display data from database in list and combo box? i use MYSQL...
help me please..... tq...1 - Write a query to retrieve the data you want from database
2 - In a servlet, connect to database, Run the query, scroll through the result set and put the data into a list of Java Objects.
3 - Set a request/session attribute of that list of objects
4 - Forward to JSP
5 - In JSP, create a <select> box, and then use a <c:forEach> loop to generate <option> tags from the list. -
Show text box from one combo box selection
Total newb here and need help. I tried searching for a javascript to copy/paste, but without any luck. I am using Acrobat Pro 9.2.0. If you could help me out with the javascript or with directions on how to make the following be accomplished, I would be greatly appreciative.
I am creating a fillable PDF and currently have a combo box that is labeled "Internship Satisfied By" with the options of "TCoB PDP", "MRKTNG 4185", and "Other College". I would like a hidden text box (where the end user can fill in to explain) to become visible only when the end user selects the "Other College" option, but stay hidden for the other selections. The hidden text box is labeled "Internship Explained".
Thanks in advance! JarrodUse this code as the combo box's validation script:
if (event.value == "Other College") {
getField("Internship Explained").display = display.visible;
} else {
getField("Internship Explained").display = display.hidden;
Maybe you are looking for
-
Acrobat 9: compiling responses from multiple questionnaire responses into spreadsheet
I want to send out a questionnaire to 150+ individuals, then compile responses from all parties into one spreadsheet. The form uses drop down options and text fields.
-
My mac won't allow me to login to the user account
Hi, Everytime I try to log in it says " you are unable to login to user 'useraccount' at this time". But I manage to login to the admin user account. Fyi, I have two users under this macbook. The one that is rejecting me is the additional username, w
-
After upgrading my iphone 5 to IOS 7, the iTunes Store won't open. Is there a fix for this?
-
Icon not showing up (and also some of my images periodically)
Hello All; I'm having two graphical issues with my App: 1) The Icon does not show up despite being referenced correctly and showing up fine in the simulator. Does it have to be a png of exactly the dimensions 57 x 57? 2) I have a bunch of different b
-
"Automatic running highlight with cursor"function exists on Crystal report?
Dear sir, Is there "Automatic running highlight with cursor" function in Crystal report ? Thanks a lot in advance for your advice! Best regards, Lai Oberdorf