Feb 10, 2014, 10:32 AM
[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
generates folowing javascript (missing labelField in ListFilter config):
Workaround by adding CustomConfig:
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]