Default values in FilterHeader Plugin

  1. #1

    Default values in FilterHeader Plugin

    Hi,

    How can I have in the FilterdHeader plugin, a default value. So when the user gets into the webpage it already has a filter applied. So I can avoid double trip to get the initial store I wish.

    In this case:

    https://examples2.ext.net/#/GridPane...Header/Remote/

    How can I put a default filter on the "Visible" field. I need by default appears in the filter field a "0", and so show in the grid just the Visible="No".

    By the way, in the example above (Remote Filter), if you code the "Clear Filters" button like this example:

    https://examples2.ext.net/#/GridPane...ader/Overview/

    It throws an error if your first action is clicking in this button, but if first apply manually a filter, and later click in the "Clear Filters" button it works ok.

    This is the markup I put for generating the error in the Remote Filter example:
    DockedItems>
                            <ext:Toolbar runat="server" Dock="Bottom">
                                <Items>
                                    <ext:Button runat="server" Text="Clear Filters" Handler="this.up('grid').filterHeader.setValue({Visible: '0'});">
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                    </DockedItems>
    Thanks in advance.
    Last edited by iomega55; Oct 13, 2014 at 5:37 PM.
  2. #2
    Hi @iomega55,

    It throws an error
    Thank you for the report. I have created an Issue:
    https://github.com/extnet/Ext.NET/issues/571

    As for your requirement of initial filtering, I can suggest to set this for the GridPanel:
    <Listeners>
        <ViewReady Fn="onViewReady" Delay="1" />
    </Listeners>
    <script>
        var onViewReady = function (grid) {
            Ext.Array.each(grid.filterHeader.fields, function(field) {
                if (field.column.dataIndex === "Visible") {
                    field.setValue("0");
                    return false;
                }
            });
        };
    </script>
    and AutoLoad="false" for the Store.

Similar Threads

  1. [CLOSED] Filtering using FilterHeader plugin and Turkish language
    By metci in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 22, 2014, 9:46 AM
  2. [CLOSED] Default operator for FilterHeader fields
    By metci in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 20, 2014, 12:02 PM
  3. Hide/Show FilterHeader Plugin
    By ADV in forum 2.x Help
    Replies: 2
    Last Post: Dec 24, 2013, 1:46 AM
  4. [CLOSED] Grid FilterHeader default type search
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 28, 2013, 2:39 PM
  5. [CLOSED] FilterHeader Plugin Error
    By leonardm in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 21, 2013, 4:53 PM

Tags for this Thread

Posting Permissions