[CLOSED] ListFilter with a StoreID

Page 2 of 2 FirstFirst 12
  1. #11
    Hi Jens,

    Please look at the example how you can achieve this.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] {
                                             new object[] {"test1"},
                                             new object[] {"test2"},
                                             new object[] {"test3"}
                                    };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var optionsBind = function(grid) {
                var options = [];
                grid.getStore().each(function(record) {
                    options.push(record.get('test'));
                });
                grid.filters.getFilter('test').updateOptions(options);
            }
        </script>
    
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                    <Listeners>
                        <Load Handler="optionsBind(#{GridPanel1});" />
                        <Add Handler="optionsBind(#{GridPanel1});" />
                        <Remove Handler="optionsBind(#{GridPanel1});" />
                        <Update Handler="optionsBind(#{GridPanel1});" />
                        <DataChanged Handler="optionsBind(#{GridPanel1});" />
                    </Listeners>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <Plugins>
                <ext:GridFilters>
                    <Filters>
                        <ext:ListFilter DataIndex="test" Options=" " />
                    </Filters>
                </ext:GridFilters>
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>
    Can you tell how soon the new release will be available?
    It's out of my competence.
    Some information you can get following this link:
    http://forums.ext.net/showthread.php...on-1.0-Preview
  2. #12
    Hi Daniil,

    once again, thanks for your reply!

    Unfortunately it doesn't work:

    var filter = GridPanel1.filters.getFilter('PropertyName');
    filter.updateOptions(options);
    The error is "filter.updateOptions is not a function". Guess I would have found that in my previous experiments if it was there ;-)

    Yet another version issue?
  3. #13
    Yet another version issue?
    Not sure.

    Did you try the code without any changes? Did it work?
  4. #14
    Did you try the code without any changes? Did it work?
    Sorry, no, I didn't. But I'm pretty sure it wouldn't have worked either. I examinded the filter object in Firebug and found it just doesn't have a updateOptions() function...

    Anyway, somehow I (accidentally ;-) debugged into the source of the ux and was able to figure out what the updateOptions() function is doing (I guess). Here's what I'm doing now:

            var Store1_Load = function () {
                var plugin = GridPanel1.getFilterPlugin();
    
                var filter = plugin.getFilter("PropertyName");
                if (filter && filter.menu)
                    filter.menu.destroy();
                plugin.filters.removeKey("PropertyName");
    
                var options = [];
                Store1.each(function (record) {
                    var propName = record.get('PropertyName');
                    if (options.indexOf(propName)==-1)
                        options.push(propName);
                });
    
                var filter = plugin.addFilter({ dataIndex: "PropertyName", type: "list", options: options });
            }
    This is working fine for me so far, so thanks again. I'll be looking forward to having an easier method with the next release, but for now, I'm a happy camper!
  5. #15
    So, you are right that the updateOptions came to the toolkit after Ext.Net 1.0 community release.

    Nice to help you.
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] Setting StoreID on GridFilter to IFrame location
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 27, 2012, 1:39 PM
  2. [CLOSED] ListFilter problem
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 12, 2012, 12:51 PM
  3. [CLOSED] How to Initialize a ListFilter with Value(s) ?
    By IT1333 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 01, 2011, 8:35 PM
  4. Comboboxes with same StoreID problem
    By vostro1700 in forum 1.x Help
    Replies: 2
    Last Post: Jul 31, 2009, 3:56 PM
  5. problem with multiple dropdownlists using the same storeid
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 22, 2009, 7:34 AM

Tags for this Thread

Posting Permissions