The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

[FIXED] [#1572] [4.5.0] filter header disappeared after reconfig with new cols

Page 2 of 2 FirstFirst 12
  1. #11
    Hi Fabricio, Thank you so much for all your details. Really appreciate it!
    I copied your code, run it under vs2015. This is the screen result after click on reconfig button:
    Click image for larger version. 

Name:	colReconfig1.png 
Views:	3 
Size:	46.3 KB 
ID:	25095

    Please notice the new columns still not having filter header.

    I replaced grid.ColumnModel.RemoveAll() with grid.RemoveAllColumns() old columns are gone but the new one still has no filter header.
    Click image for larger version. 

Name:	colReconfig2.png 
Views:	3 
Size:	35.3 KB 
ID:	25096

    Not sure why this does not work on my machine. I tried with the latest ext.mvc5.dll too. The filter header works fine if I change to use WebForm ext.dll. Any idea?
  2. #12
    Hello Susan!

    Sorry for that, I really lost the point here!

    I was adjusting the sample to work and I missed the main point: the added columns with the command just didn't add the field!

    I'm reviewing the example, I think I found something very interesting about this, due to my silly mistake... Actually because you tried to port it to MVC and AddColumn() didn't work. I'll get back to you soon.
    Fabrício Murta
    Developer & Support Expert
  3. #13
    Thanks! Looking forward to hear from you!
    As long as RemoveAll/AddNew OR Add/Remove specific columns works then I don't need reconfig() any more. The good news is it works for webForm, just need it to work for
    Thanks in advance!
  4. #14
    Hello again Susan!

    Looks like there are two issues, that even AddColumn() and InsertColumn() don't work in MVC's code behind.

    The problem is that, in WebForms, code behind knows the initial grid configuration (whereas knowing it has the FilterHeader plug in attached).

    For MVC, when we get a reference for the grid via X.GetCmp<GridPanel>("gpanelTest"), the retrieved reference to the grid does not actually has any different thing attached to it.

    In post #9, I've said:

    The time the columns are rewritten during a reconfigure (specifying the new column model) disallows to apply the filter header settings, and the easiest way seems to just reconfigure it to an empty grid then add the columns after the grid is re-rendered and the filterheader plugin can touch what it needs in order to set up the column headers.
    This is quite wrong. In fact, there's no client-side handling of the column settings when columns are added at all. This is all done server-side, and the column definition you provide to the add and insert methods are just tampered with the necessary settings to implement the filter header whenever the column matches some pre-requisites (its type, being filterable).

    As you are stuck to an older version of Ext.NET, I'm sure you can't benefit from the fix from latest version. But as the issue was still actual down to Ext.NET 4.5.0, I'll post the reviewed controller code with a workaround for this.

    public DirectResult c62207_reconfig()
        DirectResult response = new DirectResult();
        var btn = X.GetCmp<Button>("ReconfigBtn");
        btn.Disabled = true;
        var newcols = new List<ColumnBase>() {
            new DateColumn
                Text = "Last Updated",
                Width = 85,
                Sortable = true,
                DataIndex = "lastChange",
                Format = "M/d/yyyy"
            new Column
                Text = "Company",
                Width = 150,
                DataIndex = "company"
        var grid = X.GetCmp<GridPanel>("gpanelTest");
        // From MVC, just by X.GetCmp() you can't know whether the grid has
        // the FilterHeader plug in, so we should just add it, then.
        grid.Plugins.Add(new FilterHeader());
        #region Workaround for issue #1572
        // Manually adding the to-be-added columns indirectly crafts the
        // columns' definition to include the FilterHeader's necessary
        // settings.
        newcols.ForEach(col => grid.ColumnModel.Add(col));
        #endregion Workaround for issue #1572
        // Now reconfiguring with the right column definitions will do.
        return response;
    Furthermore, as the actual issue was identified, it was straightforward to fix it in Ext.NET, so that fix is going to make it to the next Ext.NET release, currently 4.5.1 (may change to 4.6.0 if a bigger/feature change makes it to the release).

    Please notice line 29 of the code is required regardless of the fix due to a limitation in how MVC works with Ext.NET. The reason you couldn't port the WebForms sample to MVC is probably this. The fetched grid reference needs to have the plug in (and any other plug ins that might incur into side effects like this), or else even the commands that worked in WebForms would not have the desired effects in MVC.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #15
    Awesome! my issue resolved! Millions thanks!
    Happy new year!
  6. #16
    Hello Susan!

    Thanks for the feedback, glad it really helped! Well, and thanks also for your patience throughout the process, including the mishap about the provided example.

    Have a great 2018 you too! :)
    Fabrício Murta
    Developer & Support Expert
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 4
    Last Post: Jul 05, 2016, 8:18 PM
  2. GridPanel Filter Header
    By hidaextnet in forum 1.x Help
    Replies: 1
    Last Post: Dec 31, 2014, 2:44 PM
  3. Replies: 1
    Last Post: Mar 20, 2013, 4:18 PM
  4. Remote filter for Header Filter
    By huzzy143 in forum 1.x Help
    Replies: 2
    Last Post: May 09, 2012, 3:43 PM
  5. Replies: 3
    Last Post: Sep 09, 2010, 6:31 AM

Posting Permissions