Oct 11, 2011, 12:15 PM
Values added to store(inside Ext Window) are lost when lightbox(Ext Window) is shown for the first time after page load
Hi,
I am using an Ext Window as light box which is having a combo box and store. The data source for the combo box is the store.
I add records to the above store(store with ID "LightboxStore") while opening the light box(Please see the functions "OpenLightbox()" and "syncLightBoxStores()"). But the items added to the store are disappearing while the light box is shown for the first time. Afterwards it works fine. This problem is happening only for the first time when showing the lightbox for the first time ,after the page loads.(After first time i am able to add records to the store successfully and gets reflected in the combo box in the light box)
Any helps are really appreciated
Regards
Jophin
I am using an Ext Window as light box which is having a combo box and store. The data source for the combo box is the store.
I add records to the above store(store with ID "LightboxStore") while opening the light box(Please see the functions "OpenLightbox()" and "syncLightBoxStores()"). But the items added to the store are disappearing while the light box is shown for the first time. Afterwards it works fine. This problem is happening only for the first time when showing the lightbox for the first time ,after the page loads.(After first time i am able to add records to the store successfully and gets reflected in the combo box in the light box)
<ext:Window Hidden="true" AutoScroll="true" AutoHeight="true" Width="356px" Closable="true"
HideParent="true" Modal="true" Resizable="false" Header="false" runat="server"
Shadow="Frame" ID="tswindow">
<Content>
<div id="divUserControl">
<ext:Store ID="LightboxStore" OnSubmitData="SaveData" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="Name" Type="String" />
<ext:RecordField Name="Type" Type="String" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</div>
</Content>
<Listeners>
<Hide Fn="lightboxCloseCallback" />
</Listeners>
</ext:Window>
//I needed to add a few records to the lightbox store( these records needed to be binded to a combo box list in the lightbox which I have not provided in //the code above)
//I'm using a function like the below to add records to the lightbox store
//this function gets called in the OpenLightbox() method which open the light box
function syncLightBoxStores() {
var store1 = getStore1();
AddRecords(store1.data.items);
}
//I am calling the syncLightBoxStores() when opening the lightbox
//Function to open light box
function OpenLightbox(lightBoxId) {
syncLightBoxStores();
var window = Ext.getCmp(lightBoxId);
window.show();// showing lightbox
}
function AddRecords(records) {
var store = getStore(getLightBoxStoreId()); // i'm able to get the lightbox store and add records successfully
for (var i = 0; i < records.length; i++) {
var rc = records[i];
var data = { Name: rc.get("Name"), Type: rc.get("Type")};
store.addRecord(data);// adding records successful
}
store.commitChanges();
}
Any helps are really appreciated
Regards
Jophin
Last edited by Daniil; Oct 11, 2011 at 4:33 PM.
Reason: Please use [CODE] tags