[CLOSED] GridFilters - ListFilter - LabelField does not generate in labelField in JSON config

  1. #1

    [CLOSED] GridFilters - ListFilter - LabelField does not generate in labelField in JSON config

    Using Ext.Net 2.4 on MVC 5 using Razor

    following Code for ListFilter

                    @(Html.X().GridPanel()
                        .ID("PropertyGridPanel")
                        .Store(
                            Html.X().StoreForModel()
                                .Proxy(
                                    Html.X().AjaxProxy()
                                        .Url(Url.Action("GetProperties"))
                                        .Reader(Html.X().JsonReader().Root("data"))
                                )
                                .RemoteSort(true)
                                .PageSize(20)
                                .SorterFor(Model, m => m.Id, Ext.Net.SortDirection.ASC)
                        )
                        .ColumnModel(
                            Html.X().RowNumbererColumn().Text("Lp.").Width(35),
                            Html.X().ColumnFor(m => m.Id),
                            Html.X().ColumnFor(m => m.DisplayName),
                            Html.X().ColumnFor(m => m.Description),
                            Html.X().ColumnFor(m => m.PropertyValueType),
                            Html.X().ColumnFor(m => m.PropertyType),
                            Html.X().ColumnFor(m => m.CreatedBy),
                            Html.X().ColumnFor(m => m.ModifiedBy),
                            Html.X().ColumnFor(m => m.CreatedOn),
                            Html.X().ColumnFor(m => m.ModifiedOn)
                        )
                        .Features(
                              Html.X()
                                  .GridFilters()
                                  .Filters(
                                      Html.X()
                                        .ListFilter()
                                        .DataIndex(Model, m => m.PropertyType)
                                        .CustomConfig(a => a.AddRange(new List<ConfigItem>()
                                        {
                                            new ConfigItem("store", "Ext.StoreMgr.get('PropertyTypeStore')", ParameterMode.Raw) //StoreId generates Exception bug subbimission in other thread
                                        }))
                                        .LabelField("Display")
                                        .IDField("Id")
                                  )
                        ).ToScript()

    generates folowing javascript (missing labelField in ListFilter config):
    Ext.net.ResourceMgr.load([{
                url : "/ux/grid/gridfilters/gridfilters-js/ext.axd?v=28616"
            }, {
                mode : "css",
                url : "/ux/resources/gridfilters-embedded-css/ext.axd?v=28616"
            }
        ], function () {
        Ext.net.ResourceMgr.destroyCmp("App.PropertyGridPanel");
        Ext.create("Ext.grid.Panel", {
            store : {
                model : Ext.define(Ext.id(), {
                    extend : "Ext.data.Model",
                    fields : [{
                            name : "Id",
                            type : "int"
                        }, {
                            name : "DisplayName",
                            type : "string"
                        }, {
                            name : "Description",
                            type : "string"
                        }, {
                            name : "PropertyValueType",
                            type : "string"
                        }, {
                            name : "PropertyType",
                            type : "string"
                        }, {
                            name : "CreatedBy",
                            type : "string"
                        }, {
                            name : "ModifiedBy",
                            type : "string"
                        }, {
                            name : "CreatedOn",
                            type : "date",
                            dateFormat : "c"
                        }, {
                            name : "ModifiedOn",
                            type : "date",
                            dateFormat : "c"
                        }, {
                            name : "TimeStamp"
                        }
                    ],
                    validations : [{
                            type : "presence",
                            field : "Id",
                            message : "Pole Id jest wymagane."
                        }, {
                            type : "presence",
                            field : "CreatedOn",
                            message : "Pole Data utworzenia jest wymagane."
                        }, {
                            type : "presence",
                            field : "ModifiedOn",
                            message : "Pole Data modyfikacji jest wymagane."
                        }
                    ]
                }),
                autoLoad : true,
                proxy : {
                    type : "ajax",
                    reader : {
                        type : "json",
                        root : "data"
                    },
                    url : "/Property/GetProperties"
                },
                sorters : [{
                        direction : "ASC",
                        property : "Id"
                    }
                ],
                pageSize : 20,
                remoteSort : true
            },
            id : "PropertyGridPanel",
            renderTo : Ext.net.ResourceMgr.getRenderTarget(),
            columns : {
                items : [{
                        width : 35,
                        xtype : "rownumberer",
                        text : "Lp."
                    }, {
                        hidden : true,
                        width : 30,
                        dataIndex : "Id",
                        text : "Id"
                    }, {
                        flex : 2,
                        dataIndex : "DisplayName",
                        text : "Nazwa"
                    }, {
                        flex : 4,
                        dataIndex : "Description",
                        text : "Opis"
                    }, {
                        flex : 2,
                        dataIndex : "PropertyValueType",
                        text : "Typ wartości"
                    }, {
                        flex : 2,
                        dataIndex : "PropertyType",
                        text : "Typ właściwości"
                    }, {
                        hidden : true,
                        width : 80,
                        dataIndex : "CreatedBy",
                        text : "Utworzony przez"
                    }, {
                        hidden : true,
                        width : 80,
                        dataIndex : "ModifiedBy",
                        text : "Zmodyfikowany przez"
                    }, {
                        hidden : true,
                        width : 80,
                        dataIndex : "CreatedOn",
                        text : "Data utworzenia"
                    }, {
                        hidden : true,
                        width : 80,
                        dataIndex : "ModifiedOn",
                        text : "Data modyfikacji"
                    }
                ]
            },
            features : [Ext.create("Ext.ux.grid.FiltersFeature", {
                    ftype : "feature",
                    filters : [{
                            store : Ext.StoreMgr.get('PropertyTypeStore'),
                            dataIndex : "PropertyType",
                            type : "list",
                            idField : "Id"
                        }
                    ]
                })]
        });
    });

    Workaround by adding CustomConfig:
    .CustomConfig(a => a.AddRange(new List<ConfigItem>()
                                        {
                                            new ConfigItem("labelField", "Display")
                                        }))
    Last edited by Daniil; Feb 10, 2014 at 12:33 PM. Reason: [CLOSED]
  2. #2
    Hi @Redgood,

    Welcome to the Ext.NET forums and thank you for the report!

    Fixed in the SVN trunk, revision #5660. It will go to the v2.5 release.
  3. #3
    I hurried a bit. The LabelField should be rendered only if a ListFilter's StoreID is used. Now I am working on this one:
    http://forums.ext.net/showthread.php?28037
  4. #4
    Quote Originally Posted by Daniil View Post
    I hurried a bit. The LabelField should be rendered only if a ListFilter's StoreID is used. Now I am working on this one:
    http://forums.ext.net/showthread.php?28037
    So if LabelField should be rendered only if StoreId is used, then this rule should be also applied to IDField (rendered only when StoreId is used).

    Am i right ?
  5. #5
    You are right, there should be the same policy for both the properties. Maybe, it is better to remove that StoreID check for the LabelField... I will think about it tomorrow morning with a clear head:) Thank you for pointing it out.
  6. #6
    Now a ListFilter's LabelField is rendered regardless the StoreID property. Now it is under developer's responsibility. It is done in the revision #5663 and will go to the v2.5 release.

    Thank you for pointing it out.

Similar Threads

  1. [CLOSED] Update GridFilters ListFilter Store Server-Side
    By jwhitmire36 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 23, 2013, 2:44 PM
  2. GridPanel: ListFilter Bug
    By Stemmer in forum 1.x Help
    Replies: 8
    Last Post: Mar 27, 2013, 10:51 AM
  3. ListFilter with mappings
    By syncos in forum 1.x Help
    Replies: 8
    Last Post: Dec 15, 2010, 1:40 PM
  4. Replies: 0
    Last Post: Aug 05, 2009, 9:48 AM

Posting Permissions