我是 stackoverflow 和 ext.net 编程的新手,我想扩展 Ext.Net.Window 并添加新属性,即 Store。下面是我的代码:
C#代码:
public class ExtNetBaseWindowDB : Ext.Net.Window
{
private Store FDBStore;
protected override List<Ext.Net.ResourceItem> Resources
{ get {
List<Ext.Net.ResourceItem> baseList = base.Resources;
baseList.Capacity += 1;
baseList.Add(new Ext.Net.ClientScriptItem(typeof(ExtNetBaseWindowDB), "Ext.Net_Lib.Scripts.ExtNetBaseWindowDB.js", "/Scripts/ExtNetBaseWindowDB.js"));
return baseList; }
}
protected override void OnInit(EventArgs e)
{ FDBStore = new Store {
ID = "store__",
PageSize = 5,
Model = {
new Model {
ID="model__",
Fields = {
new ModelField("Field01", ModelFieldType.String),
new ModelField("Field02", ModelFieldType.Float) }
}
}
};
base.OnInit(e);
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[XmlIgnore]
[JsonIgnore]
public override ConfigOptionsCollection ConfigOptions
{ get {
ConfigOptionsCollection list = base.ConfigOptions;
list.Add("dbStore", new ConfigOption("dbStore", new SerializationOptions("dbStore", JsonMode.Object), null, DBStore));
return list;
}
}
public Store DBStore
{ get { return FDBStore; } }
}
Javascript 文件:
ExtNet.ExtNetBaseWindowDB = Ext.extend(Ext.window.Window, {
dbStore: null,
initComponent: function () {
ExtNet.ExtNetBaseWindowDB.superclass.initComponent.call(this); },
initEvents: function () {
ExtNet.ExtNetBaseWindowDB.superclass.initEvents.call(this); },
onRender: function (ct, position) {
ExtNet.ExtNetBaseWindowDB.superclass.onRender.call(this, ct, position); }
});
来自服务器的响应:
Ext.net.ResourceMgr.init({
id: "ResourceManager1",
aspForm: "form1",
icons: ["PageSave", "Cancel"]
});
Ext.onReady(function () {
Ext.create("Ext.window.Window", {
hidden: false,
renderTo: Ext.get("form1"),
width: 200
});
Ext.create("ExtNet.ExtNetBaseWindowDB", {
id: "wnd__",
itemId: "item__",
height: 300,
hidden: false,
renderTo: Ext.getBody(),
width: 300,
layout: "form",
title: "ExtNetBaseWindowDB",
dbStore: new Ext.data.Store({
model: ,
storeId: "store_ExtNetBaseWindowDB",
autoLoad: true,
pageSize: 5,
proxy: {
type: 'memory'
}
})
});
请帮助我,我的窗口不显示,我的代码有问题吗?(如果我的英语不好,我很抱歉)