DevExpress XAF, Application Model, Combo box Just Show "OId" - devexpress

When I add a member to my BOModel and write a simple expression like:
[Name] +' ' + [Age]
But in runtime I see something like this:
ROP.Module.BusinessObjects.ROP.Product(4)
That field just show me "OId" but not show related value!
Note: that fields are simple textbox is OK, but that fields came from relation to other table are missing.
Please guide me how to solve this issue.
Some screen shot :
[![http://i.stack.imgur.com/JAQXn.png][1]][1]
[![http://i.stack.imgur.com/j5I2Q.png][2]][2]

in your class, add this line :
namespace YourApp.Module.BusinessObjects
{
[Default Property ("Field401")] // add this line
[DefaultClassOptions]
Field401 is the field you want to display during the runtime.

You should use the XafDefaultProperty attribute.
namespace Rop.Module.BusinessObjects
{
[XafDefaultProperty("DescRegistation")]
[DefaultClassOptions]
public partial class Product
{
...
}
}
If the property that you want to display in another object's view is not the one you wish to set as default, then you can set it in the Model Editor as shown in the above link.

Related

Form data source edit method on a view - AX 2009

I am trying to add a edit method to my grid from my data source in the form. I have the following code for the edit method:
edit boolean markLine(
boolean set,
Datasource _datasource,
boolean _mark
)
{
if (set)
{
if (!_mark)
{
if (selectedLines.exists(_datasource.RecId))
{
selectedLines.remove(_datasource.RecId);
}
}
else
{
selectedLines.insert(_datasource.RecId,_datasource.recVersion);
}
}
return selectedLines.exists(_datasource.RecId);
}
I then drag that into a grid which has the datasource specified in it and contains other fields from that datasource. Yet, when I try to use it in the grid, it is not possible to check the box.
I am using a view for my data source, not a table. I am not sure if this is the reason for it or if there is something else that is the problem. Any idea what the problem could be here?
Thanks in advance.
Edit
AllowEdit on the data source is true.
Ok, I checked around some more and found the following in the AX documentation about views
Views are read-only. The data fields and tables that a view uses cannot be updated from that view.
Therefore, edit methods will not work because views cannot be edited in the first place.
Edit
A workaround for this is to override the mouseDblClick method in the grid. Add the following code lines after the super():
Datasource_ds.selectedLines(true, Datasource, !selectedLines.exists(Datasource.RecId));
Datasource_ds.refresh();
Then when the user double clicks a method, it is selected.

Wicket custom filter without dropdown table

I want to create a custom filter for my DataTable. I would like to create a button that, when clicked on it, changes the table its data. I know about the ChoiceFilteredPropertyColumn that wicket has to offer but this is, according to my understanding of it, a dropdown filter.
I am trying to achieve something like the following picture (Pancakes is the clickable button):
Could someone point me in the right direction?
Well... the superclass of ChoiceFilteredPropertyColumn is FilteredPropertyColumn which might do the trick. Otherwise you could always implement your own Column that implements IFilteredColumn the way you like it.
Look at how the implemented `DataTable' here: http://www.packtpub.com/sites/default/files/1605OS-Chapter-5-Displaying-Data-Using-DataTable.pdf
Then you could implement your dropdown button filter like you want it and filter with the selected value the DataTable.
I solved this question by creating a custom filter (just a panel with some markup) and return it in the getFilter method of a custom FilteredPropertyColumn.
FilteredPropertyColumn:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilteredPropertyColumn.html
getFilter method:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/IFilteredColumn.html#getFilter%28java.lang.String,%20org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm%29
ButtonFilter class:
public class ButtonFilter extends Panel {
...
}
In custom FilteredPropertyColumn class:
#Override
public Component getFilter(String componentId, FilterForm<?> form) {
return new ButtonFilter<Y>(componentId, getFilterModel(form), filterChoices);
}

target and display an object of list control in flex

i have made a list control. i want to display the name of the objects in it in a text control box
the code i am using here is
public function add(event:MouseEvent):void
{
var str:String;
str = mylistcontrol.dataProvider.getItemAt(0).toString();
mytextarea.text += str+ "has been added";
mytextarea.text += "\n";
}
The problem with this code is i am using index value of 0. however i want to display the name of object on which i have clicked or which is highlighted.
any ideas and thoughts?
When you say the name of the object do you mean the name of the ItemRenderer?
If that's the case one method you could use involves creating a custom event and a custom item renderer...
Create a custom ItemRenderer when clicked dispatch your CustomEvent which would a have a data property into which you can put anything you like.

Add support for fields to databound controls

For example when using a gridview. When you specify the columns
BoundField for example won't work if you are binding it to a field instead of a property.
I guess this is so because when the gridview is looking for the DataField property it looks for a property and not a field. Now the question is how can i change this behavior to make it possible to use fields. I know i have to inherit from the gridview, but i don't know where to go from there.
This functionality is so wrapped into the framework and wasn't designed for extensibility so no you can't change this behavior; the only thing you can do is to create wrapper objects or wrap fields with properties.
Or render the UI in your own way, which then you lose the GridView in-built functionality.
Wrap the fields with Properties
private string fieldA;
public string FieldA
{
get { return fieldA; }
set { fieldA = value; }
}

How do I make a property of custom control to be a generic type?

I have created a custom ASP.NET control ( derived from WebControls.TextBox).
I want to add a property to that control which will be of a type.
This property will actually always be some type of enum .
So when in the designer I look at the properties window of that control - I want to be able to assign value to that property by a selection from the specific enum .
So I want to see there the list of enumerators from the enumeration that I pass as ..
Example ( not actuall code that will compile .. just to show what I mean):
I have 2 enums :
enum MyEnumABC
{
A,B,C
}
enum MyColor
{
Red,Blue,Green
}
I have this control:
public class MyTextBox<T> : TextBox
{
public T Classification
{
get { }
set { }
}
}
Now I create a webpage which have following controls:
<Alex:MyTextBox runat=server id="alex" Classification=MyEnumABC.A></Alex:MyTextBox>
<Alex:MyTextBox runat=server id="alex2" Classification=MyColor.Red></Alex:MyTextBox>
The question is where can I actually pass the type to the constructor of that control ?
( since the page class is the one who calls the constructors of the controls.)
Where I actually need to set the type of alex1 to be of MyEnumABC , and the type of alex2 of type MyColor.
And the second question is how I make the VS2008 to support this in the designer of HTML ( so that when I type the Classification in the tag - it will open the write enum for selection of the value) and the property page of the control.
I hope you understand what I mean here.
Thanks .
The designer will support enum properties without you having to do anything special. Just specify the property in your control's code, give it all the usual attributes to allow it to be displayed in the property window and the property window will automatically display the enum values in a dropdown.

Resources