Mar 31, 2010, 9:22 AM
Linked/Referenced stores
Hello,
I often thought about having a better performance and cleaner code, if I would be able to link stores like a ForeignKey in a database table, because it would save much traffic.
As example:
I have this store:
[CODE]
<ext:Store runat="server" ID="StoreSystems" AutoLoad="true"
DataSourceID="objectDataSourceVCSystems" OnRefreshData="StoreSystems_Refresh"
RemoteSort="true" RemotePaging="true" ShowWarningOnFailure="true">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="SYSTEM_ID" TotalProperty="total">
<Fields>
<ext:RecordField Name="Id" Mapping="SYSTEM_ID" />
<ext:RecordField Name="LAND_CODE_ISO" />
<ext:RecordField Name="SYSTEM_BEZEICHNUNG" Mapping="SYSTEM_BEZEICHNUNG" />
<ext:RecordField Name="TIMEZONE_ID" Mapping="TIMEZONE_ID" />
<ext:RecordField Name="TIMEZONE_OFFSET" Mapping="TIMEZONE_OFFSET" />
<ext:RecordField Name="TIMEZONE_DESCRIPTION" Mapping="TIMEZONE_DESCRIPTION" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
[CODE]
For some reasons I must refresh this whole store, if the TIMESET_OFFSET changes (e.g. if a user selects a date from a datefield and this date causes changes on daylight saving times).
If I have 20000 Systems in that store a change-date-event causes much unnecessary traffic.
Therefore a combination with 2 stores would be very nice:
I have a syntax in mind like:
That would be really cool!
Regards,
Martin
I often thought about having a better performance and cleaner code, if I would be able to link stores like a ForeignKey in a database table, because it would save much traffic.
As example:
I have this store:
[CODE]
<ext:Store runat="server" ID="StoreSystems" AutoLoad="true"
DataSourceID="objectDataSourceVCSystems" OnRefreshData="StoreSystems_Refresh"
RemoteSort="true" RemotePaging="true" ShowWarningOnFailure="true">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="SYSTEM_ID" TotalProperty="total">
<Fields>
<ext:RecordField Name="Id" Mapping="SYSTEM_ID" />
<ext:RecordField Name="LAND_CODE_ISO" />
<ext:RecordField Name="SYSTEM_BEZEICHNUNG" Mapping="SYSTEM_BEZEICHNUNG" />
<ext:RecordField Name="TIMEZONE_ID" Mapping="TIMEZONE_ID" />
<ext:RecordField Name="TIMEZONE_OFFSET" Mapping="TIMEZONE_OFFSET" />
<ext:RecordField Name="TIMEZONE_DESCRIPTION" Mapping="TIMEZONE_DESCRIPTION" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
[CODE]
For some reasons I must refresh this whole store, if the TIMESET_OFFSET changes (e.g. if a user selects a date from a datefield and this date causes changes on daylight saving times).
If I have 20000 Systems in that store a change-date-event causes much unnecessary traffic.
Therefore a combination with 2 stores would be very nice:
<ext:Store runat="server" ID="StoreSystems" AutoLoad="true"
DataSourceID="objectDataSourceVCSystems"
OnRefreshData="StoreSystems_Refresh"
RemoteSort="true" RemotePaging="true"
ShowWarningOnFailure="true">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="SYSTEM_ID"
TotalProperty="total">
<Fields>
<ext:RecordField Name="Id" Mapping="SYSTEM_ID" />
<ext:RecordField Name="LAND_CODE_ISO" />
<ext:RecordField Name="SYSTEM_BEZEICHNUNG"
Mapping="SYSTEM_BEZEICHNUNG" />
<ext:RecordField Name="TIMEZONE_ID"
Mapping="TIMEZONE_ID" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Store ID="StoreTimeZones" runat="server" AutoLoad="true" DataSourceID="objectDataSourceTimeZones" OnRefreshData="StoreTimeZones_Refresh">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="TIMEZONE_ID" TotalProperty="total">
<Fields>
<ext:RecordField Name="TIMEZONE_ID" />
<ext:RecordField Name="TIMEZONE_DESCRIPTION" />
<ext:RecordField Name="TIMEZONE_OFFSET" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="date" Encode="false" Mode="Raw" Value="#{dateFieldBookingDate}.SelectedDate" />
</BaseParams>
<Listeners>
<LoadException Handler="Ext.MessageBox.alert('Load failed', response.statusText);" />
</Listeners>
</ext:Store>
If I could access the TIMEZONE_OFFSET via my "StoreSystems" like having a ForeignKey from StoreTimeZones.TIMEZONE_ID to StoreSystems.TIMEZONE_ID in a database table.I have a syntax in mind like:
<ext:Store runat="server" ID="StoreSystems">
//...
<ext:JsonReader IDProperty="SYSTEM_ID"
TotalProperty="total">
<Fields>
//...
<ext:RecordField Name="TIMEZONE_ID"
Mapping="TIMEZONE_ID" />
<ext:RecordField Name="TIMEZONE_OFFSET"
Mapping="#{StoreTimeZones}.TIMEZONE_OFFSET" Mode="Raw" MappingReference="TIMEZONE_ID"/>
That would be really cool!
Regards,
Martin