Ticket Q320085
Visible to All Users

Refresh Listview from Other DetailsView

created 14 years ago

Dear Sir,
How to invoke refresh function of a one objects listview from another object detailsview.??
Detailsview is not of the same listview, but opened from the listview using simple action.
Regards
Subodh

Comments (3)
Dennis Garavsky (DevExpress) 14 years ago

    Hello Subodh,
    Thank you for your message.
    To open your DetailView in ViewController you use, you should keep a reference to a required ListView and then call its ListView.ObjectSpace.Refresh method. That's it.
    If you need any further assistance, please provide us with your controller code or even better with a small sample project. We will be glad to help you further.
    Thanks,
    Dennis

    S S
    Subodh Sharma Mlr 14 years ago

      Dennis,
      Find below my controllers code.
      public partial class ItemsServiceActionController : ViewController
          {
              public ItemsServiceActionController()
              {
                  TargetObjectType = typeof(Items);
                  TargetViewType = ViewType.ListView;
                  SimpleAction action = new SimpleAction(this, "Service",
                  DevExpress.Persistent.Base.PredefinedCategory.View);
                  action.ImageName = "Service";
                  action.SelectionDependencyType = SelectionDependencyType.RequireSingleObject;
                  action.Execute += new SimpleActionExecuteEventHandler(Action_Execute);
              }
              void Action_Execute(object sender, SimpleActionExecuteEventArgs e)
              {
                  IObjectSpace os = Application.CreateObjectSpace();
                  Items item = os.GetObject<Items>((Items)e.SelectedObjects[0]);
                  if (item != null && item.ProStat != Items.PStat.Dead &&
                      item.ProStat != Items.PStat.ServiceRequest &&
                      item.ProStat != Items.PStat.WarrantyRequest)
                  {
                      Service service = os.CreateObject<Service>();
                      service.ServiceItem = item;
                      DetailView detailView = Application.CreateDetailView(os, service);
                      e.ShowViewParameters.CreatedView = detailView;
                  }
              }
          }
      Action_Execute opens the DetailsView for Service from Items ListView. Once Service is saved or Closed, i need to Refresh Items ListView.
      Regards
      Subodh

      Dennis Garavsky (DevExpress) 14 years ago

        Hello,
        You can modify your code as follows:

        C#
        ... detailView.ObjectSpace.Committed += new EventHandler(ObjectSpace_Committed); ... void ObjectSpace_Committed(object sender, EventArgs e) { <YourNestedListView>.ObjectSpace.Refresh(); //OR //<YourNestedListView>.CollectionSource.Reload(); }

        Let me know if this helps.
        Thanks,
        Dennis

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.