New Posts New Posts RSS Feed: How can change the DataConverter?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How can change the DataConverter?

 Post Reply Post Reply
Author
aladdin View Drop Down
Newbie
Newbie
Avatar

Joined: 18-Dec-2007
Posts: 11
Post Options Post Options   Quote aladdin Quote  Post ReplyReply Direct Link To This Post Topic: How can change the DataConverter?
    Posted: 10-Jun-2008 at 12:21am
i think is right

public class CustomerGridBuilder : DevExGridBuilderBase {

      /// <summary>Recipe for building the Grid.</summary>
      protected override void BuildCore() {
        StyleGridToStandard();
        EntityPropertyDescriptors.CustomerPropertyDescriptor descriptors = EntityPropertyDescriptors.Customer;
        AddColumnReadOnly(descriptors.Id, "Id");

        IEntityEditorController editor = EditorService.GetEditor(WorkItem.ID);
        list = ((Customer)editor.RootEntity).Orders;
        list.ListChanged += new System.ComponentModel.ListChangedEventHandler(list_ListChanged);
        cbd = AddColumn(descriptors.ContactName, "Name");
        if (list.Count > 0)
            cbd.DataConverter = IdeaBlade.UI.TextConverter.ReadOnlyField;
        else
            cbd.DataConverter = IdeaBlade.UI.TextConverter.OptionalField;
     }

      void list_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
      {
          if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemAdded ||
              e.ListChangedType == System.ComponentModel.ListChangedType.ItemDeleted)
          {

              if (list.Count > 0)
                  cbd.DataConverter = IdeaBlade.UI.TextConverter.ReadOnlyField;
              else
                  cbd.DataConverter = IdeaBlade.UI.TextConverter.OptionalField;
          }
      }
   
    /// <summary>Get the grid column widths.</summary>
    protected IEntityEditorService EditorService {
      get {
        if (mEditorService == null) {
          mEditorService = WorkItem.Services.Get<IEntityEditorService>();
        }
        return mEditorService;
      }
    }

      private ControlBindingDescriptor cbd;
      private ReadOnlyEntityList<SizesPalletLn> list;
      private IEntityEditorService mEditorService;


Back to Top
aladdin View Drop Down
Newbie
Newbie
Avatar

Joined: 18-Dec-2007
Posts: 11
Post Options Post Options   Quote aladdin Quote  Post ReplyReply Direct Link To This Post Posted: 12-May-2008 at 7:51pm
Hello,

the GridBuilder method add columns for every custom GridView we want to create,

if want to add  read only columns use DataConverter.ReadOnlyField ,

in my case want to add read only columns when the entity has children

how to do this ?

The View and the presenter is same for all entities, only GridBuilder is uniq,
the bindingsource fill after the GridBuilder...


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down