Originally Posted by
Hlodvig
Originally Posted by
Daniil
2. Reflection.
Yes, reflection is used during data binding. Unfortunately, in some cases it is not possible to avoid it. Though, we also try to avoid reflection as much as possible due to its performance costs. Generally speaking, very similar to your "conversion to Items" is being done during Store.DataBind().
Well, I think that I can avoid it my overriden DataBind function.
Well, the simplest would be replacing
foreach (object l_object in l_list)
with
foreach (SomeEntity l_object in l_list)
and access the properties by:
l_object.PropName
instead of reflection:)
Another option is using generics.
Originally Posted by
Hlodvig
Well, I don't remember in which version of FF it was started, but I remember that at some point of time js in FF had started to perform poorly...
It is a long story. ... Anyway I'll check it again after upgrading to v2.3.
An interesting fact about FireFox. Good to know, thanks. It is also interesting how v2.3 will behave with your application.
Originally Posted by
Hlodvig
I just can't stop when I do optimization job :-)
Yes, just like I thought, but anyway I just can't stop :-) and if something can be made simplier - it should be :-)
Absolutely, I follow this policy as well:)
Originally Posted by
Hlodvig
Anyway it would be good to have possibility to configure Store to be rendered as SimpleStore. May be it is possible in v2.3 - I'll check the possibility to set Store.Data property directly, but this thread can be closed - it was very informative.
Yes, it is better in v2.x.
The following example:
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.SelectBox1.GetStore();
store.Data = new object[]
{
new object[] { "1", "Item 1" },
new object[] { "2", "Item 2" },
new object[] { "3", "Item 3" }
};
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:SelectBox
ID="SelectBox1"
runat="server"
DisplayField="text"
ValueField="value">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="value" />
<ext:ModelField Name="text" />
</Fields>
</ext:Model>
</Model>
<Reader>
<ext:ArrayReader />
</Reader>
</ext:Store>
</Store>
</ext:SelectBox>
</form>
</body>
</html>
renders the following SelectBox:
Ext.create("Ext.ux.SelectBox", {
id: "SelectBox1",
renderTo: "App.SelectBox1_Container",
valueField: "value",
store: {
model: Ext.define(Ext.id(), {
extend: "Ext.data.Model",
fields: [{
name: "value"
}, {
name: "text"
}]
}),
storeId: "ctl04",
autoLoad: true,
data: [
["1", "Item 1"],
["2", "Item 2"],
["3", "Item 3"]
],
proxy: {
type: 'memory',
reader: {
type: "array"
}
}
}
});
Though, I should note again that a Store's Data is serialized by Json.NET. I think it is done using reflection. If you like to avoid it, you could still prefer to put the data into Items without reflection.
As for migrating to the v2.x.
Are you going to support IE < 9 after migration?