Ticket T1114520
Visible to All Users

Re: DxGridListEditor does not save AutoFilterRow settings

created 3 years ago (modified 3 years ago)

"We have the Save and Restore a Layout feature in our roadmap, and we plan to introduce it in the upcoming v22.1 major release.
I recommend you wait for this release and test this feature once it becomes available."

Any news? it is very important to our customers to have almost the same features like winform grid - filters and persisting grid settings is on top …

Answers approved by DevExpress Support

created 3 years ago (modified 2 years ago)

Hello,

v22.2.4+
DxGridListEditor stores the current filter criteria in the Application Model (IModelListView.Filter). Internally, it uses the DxGrid API: SetFilterCriteria(CriteriaOperator) and GetFilterCriteria().

v22.2.3-
Yes, the grid can save and restore a layout using its API. Please refer to the following example for more information: Grid for Blazor - Save and load layout information.

    Show previous comments (7)
    Anatol (DevExpress) 2 years ago

      Hello Jacek,

      Use the View.Model property to get a ListView model and read/write its values: Read and Set Values for Built-in Application Model Nodes in Code.

      The following controller illustrates this solution. Note that until we implement an out-of-the-box solution, we cannot guarantee that this approach works in all possible cases.

      C#
      using DevExpress.Blazor; using DevExpress.Data.Filtering; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Blazor.Editors; public class ListViewFilterController : ViewController<ListView> { protected override void OnActivated() { base.OnActivated(); View.ModelSaved += View_ModelSaved; View.ModelLoaded += View_ModelLoaded; } protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); GridAdapter.ComponentCaptured += (s, e) => { LoadFilter(e.Grid); }; } private void View_ModelLoaded(object? sender, EventArgs e) { LoadFilter(GridAdapter.GridInstance); } private void View_ModelSaved(object? sender, EventArgs e) { SaveFilter(GridAdapter.GridInstance); } private void SaveFilter(IGrid grid) { var criteria = grid.GetFilterCriteria(); View.Model.Filter = CriteriaOperator.ToString(criteria); } private void LoadFilter(IGrid grid) { var criteria = CriteriaOperator.Parse(View.Model.Filter); grid.SetFilterCriteria(criteria); } public IDxGridAdapter GridAdapter { get { return ((DxGridListEditor)View.Editor).GetGridAdapter(); } } }
      JK JK
      Jacek Kosinski 2 years ago

        thanks Anatol
        it works nice

        A A
        Arkady (DevExpress) 2 years ago

          Hello,

          In v22.2.4, DxGridListEditor stores the current filter criteria in the Application Model (IModelListView.Filter). Internally, it uses the DxGrid API: SetFilterCriteria(CriteriaOperator) and GetFilterCriteria().

          Thanks,
          Arkady

          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.