[CLOSED] gridpanel / listfilter configuration / remote filtering

  1. #1

    [CLOSED] gridpanel / listfilter configuration / remote filtering

    Hi

    I have a gridpanel with an ajaxproxy (.ashx) to get the desired data. The store has 2 modelfiels ("ID", "Text"). How do I have to set up my listfilter in codebehind that the user can chose from the different "Text"-Fields and the "ID" gets submited. Is that even possible (somehow with a config) or do I have to stick with the "Text" as submited value?

    If I try something like
    new ListFilter { DataIndex = "ID", LabelField = "TEXT" }
    the grid doesn't even load. I assume that is because the gridpanel loads that data after the grid filters are set up (which are waiting for the not yet loaded data)? It works when I set some Options manually but then I always have to change them, when the griddata gets changed... so there is no point in that.

    Thank you very much.

    PS: I found this but it is still totally manual...
    Last edited by Daniil; Oct 10, 2013 at 4:10 PM. Reason: [CLOSED]
  2. #2
    Hi @tMp,

    I think I understand the requirement. I will investigate possible options.
  3. #3
    The same Store cannot be used for a GridPanel and a ListFilter.

    If, for example, a GridPanel's Store is filtered, it affects on a ListFilter's Store. Because it is the same:)

    So, you could define an individual Store for a ListFilter.

    As another approach you could do the following.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
        {
            // filtering is not implemented
            Store store = sender as Store;
            store.DataSource = new object[] 
            { 
                new 
                { 
                    ID = "id1", 
                    TEXT = "text1" 
                }, 
                new 
                { 
                    ID = "id2", 
                    TEXT = "text2" 
                },
                new 
                { 
                    ID = "id3", 
                    TEXT = "text3" 
                }
            };
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var onLoad = function (store, records, successfull) {
                App.GridPanel1.filters.addFilter({
                    type: "list",
                    dataIndex: "ID",
                    idField: "ID",
                    labelField: "TEXT",
                    options: store.getRecordsValues()
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server" OnReadData="Store_ReadData">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="ID" />
                                    <ext:ModelField Name="TEXT" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Listeners>
                            <Load Fn="onLoad" Single="true" />
                        </Listeners>
                        <Proxy>
                            <ext:PageProxy />
                        </Proxy>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="ID" DataIndex="ID" />
                        <ext:Column runat="server" Text="TEXT" DataIndex="TEXT" />
                    </Columns>
                </ColumnModel>
                <Features>
                    <ext:GridFilters runat="server" Local="false" />
                </Features>
            </ext:GridPanel>
        </form>
    </body>
    </html>
    If I try something like
    new ListFilter { DataIndex = "ID", LabelField = "TEXT" }
    the grid doesn't even load.
    One of Options or StoreID settings is required for a ListFilter. So, a JavaScript occurs there.
  4. #4
    Thank you for your insight. I think I go with additional stores. But this rises a new question in this mater. I am calling this gridpanel in a window created in code behind during a direct method call. Where or how can I attached several independent stores so I can reference there ID in a couple of listfilters?

    Thank you very much.
  5. #5
    A Window's Bin collection looks a nice place for those Stores.
  6. #6
    @Daniil,

    Thanks! Everything working like a charm. Totally forgot about the bin, was throwing errors around the items ;) I am starting to really like these infinite scrolling gridpanels...

Similar Threads

  1. Replies: 6
    Last Post: Nov 03, 2012, 10:48 PM
  2. [CLOSED] Remote ListFilter (gridFilter)
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 26, 2012, 3:28 PM
  3. Get filter string for Remote Filtering
    By peter.campbell in forum 1.x Help
    Replies: 2
    Last Post: Feb 15, 2011, 3:34 PM
  4. Replies: 5
    Last Post: Jul 23, 2010, 8:52 AM
  5. remote and local filtering
    By marcmvc in forum 1.x Help
    Replies: 0
    Last Post: Oct 13, 2009, 12:38 PM

Posting Permissions