PDA

View Full Version : [CLOSED] Store data is not updating with NumberField value when clicked on Button in parent page.



iansriley
May 16, 2014, 10:59 AM
Hi,
Version : 2.5

I have scenario like there is a main page with window and button controls. when click on button window will open with another page (child page). The child page is contains grid panel with Number Field, after enter data in number fields when click on main page button the store is not giving all modified records.

After entering data in Number Field If we click on other area data is updating on store, with out clicking other area when we directly button at that time the recent change is not updating store. The same logic working for TextField.

Below is the Main page and child page code:


---- Main Page code

<ext:Panel runat="server" Title="Test" ButtonAlign="Center">
<Buttons>
<ext:Button runat="server" ID="btnRates" Text="Set Rates">
<Listeners>
<Click Handler="WindowRatesNew.show(this);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
<ext:Window runat="server" ID="WindowRatesNew"
Title="Set Rates"
Height="480"
Width="640"
Hidden="true"
Modal="true"
HideBorders="true"
Layout="Fit"
BodyStyle="background-color: white; padding:2px;"
Maximizable="true"
ButtonAlign="Center">
<Loader ID="Loader1" Mode="Frame" DisableCaching="true" Url="NumberFieldSample.aspx" runat="server">
</Loader>

<Listeners>
<Show Handler="Ext.getCmp('WindowRatesNew').reload();" />
</Listeners>

<Buttons>

<ext:Button ID="Button14" runat="server" Text="Save Rates">
<Listeners>
<Click Handler="WindowRatesNew.getBody().saveRates();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>

----- Child Page----------------

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{

Store1.DataSource = new object[]
{
new object[] { "group1", 1, 1 },
new object[] { "group1", 11, 11 },
new object[] { "group1", 111, 111 },
new object[] { "group2", 2, 2 },
new object[] { "group2", 22, 22 },
new object[] { "group2", 222, 222 }
};
}
}
</script>
<script language="javascript" type="text/javascript"">
function saveRates() {
alert(Store1.getUpdatedRecords().length);
}
</script>

<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store ID="Store1" runat="server" GroupField="groupId">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="groupId" />
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" Type="Float" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="GroupId" DataIndex="groupId" />
<ext:Column ID="Column2" runat="server" Text="Test1" DataIndex="test1" />
<ext:Column ID="Column3" runat="server" Text="Test2" DataIndex="test2">
<Editor>
<ext:NumberField runat="server" HideTrigger="true">
</ext:NumberField>
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing runat="server" ClicksToEdit="1"/>
</Plugins>
<Features>
<ext:Grouping ID="Grouping1" runat="server" />
</Features>

</ext:GridPanel>

Daniil
May 16, 2014, 12:44 PM
Hi @iansriley,

It is strange that it is working with a TextField. Anyway, I think you need to compete editing manually.



<Click Handler="var childWindow = WindowRatesNew.getBody();
childWindow.GridPanel1.editingPlugin.completeEdit( );
childWindow.saveRates();" />

iansriley
May 16, 2014, 1:26 PM
Hi @iansriley,

It is strange that it is working with a TextField. Anyway, I think you need to compete editing manually.



<Click Handler="var childWindow = WindowRatesNew.getBody();
childWindow.GridPanel1.editingPlugin.completeEdit( );
childWindow.saveRates();" />

Thanks for providing solution. It is working fine.